【发布时间】:2023-03-17 21:04:01
【问题描述】:
在启动时应用所有 http 安全性:
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/admin/**").hasRole("admin")
}
在运行时,我正在尝试添加更多内容...
applicationContext.getBean(WebSecurityConfigurerAdapter).http.authorizeRequests().antMatchers("bla").hasRole("admin")
执行该行时,会将其添加到 http.authorizeRequests() 中,但“非管理员”仍可访问 /bla
服务器重启后,此更改生效,因为它正在从数据库中加载 bla。
如何在不重新启动服务器的情况下使安全立即生效?
【问题讨论】:
-
你有解决办法吗?
-
不,如果你知道请分享:D