我花了两天时间,但我相信我终于解决了这个问题。在我的
SecurityConfiguration课堂上,我有以下方法:
@Configuration@EnableWebMvcSecurity@EnableGlobalMethodSecurity(jsr250Enabled=true, prePostEnabled=true)public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(authenticationService); }}
我
configureGlobal用一种
configure方法代替了该方法:
@Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(authenticationService); }
现在一切正常。
根据此答案的不同之处在于,使用
configureGlobal将允许
AuthenticationManager全局方法安全性或另一个HttpSecurity(WebSecurityConfigurerAdapter)。
如您在上面看到的,我同时启用了Web Mvc安全性和全局方法安全性。根据我的单元测试,两者都可以继续使用此更改,但是我的办公室在此存在一些关于此更改是否
正确 (即,如果它正确配置了全局方法安全性)或是否存在另一个问题的争论。解。
我们认为问题的根本原因是某种类型的Spring错误,可能是竞争情况。似乎不太可能,只有当我们向项目中添加一个空类时问题才显现出来,而该类的包或名称是什么都没有关系。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)