启动时应用所有http安全性:
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/admin/**").hasRole("admin")
}
Run Code Online (Sandbox Code Playgroud)
在运行时,我正在尝试添加更多...
applicationContext.getBean(WebSecurityConfigurerAdapter).http.authorizeRequests().antMatchers("bla").hasRole("admin")
Run Code Online (Sandbox Code Playgroud)
当执行该行时,它会将其添加到http.authorizeRequests(),但/ bla仍可由"非管理员"访问
重新启动服务器时,此更改将生效,因为它正在从数据库加载bla.
如何在不重新启动服务器的情况下立即使安全性生效?