Requested bean is currently in creation: Is there an unresolvable circular reference?
阿新 • • 發佈:2018-11-25
如下:
@Bean//登陸攔截器 public CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter() throws Exception { CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter=new CustomAuthenticationProcessingFilter(); customAuthenticationProcessingFilter.setAuthenticationManager(authenticationManagerBean()); customAuthenticationProcessingFilter.setAuthenticationSuccessHandler(new CustomAuthenticationSuccessHandler());//自定義成功處理 customAuthenticationProcessingFilter.setAuthenticationFailureHandler(new CustomAuthenticationFailureHandler());//自定義失敗處理 return customAuthenticationProcessingFilter; } @Autowired//登陸攔截器 private CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter;
會報錯。
可能是同時都是建立,所以衝突了,導致迴圈
刪掉 @Autowired//登陸攔截器 private CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter;