Requested bean is currently in creation: Is there an unresolvable circular reference?

如下:

@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;

 

你可能感兴趣的:(解决问题,spring,boot)