Java 原因:org.springframework.beans.FatalBeanException:检测到依赖项循环

Java 原因:org.springframework.beans.FatalBeanException:检测到依赖项循环,java,kotlin,spring-security,Java,Kotlin,Spring Security,我已经将实现的接口从UserDetailsService更改为JwtUserDetailsService,因为我开始从令牌而不是从db获取权限和角色 但开始出现以下异常 Caused by: org.springframework.beans.FatalBeanException: A dependency cycle was detected when trying to resolve the AuthenticationManager. Please ensure you have c

我已经将实现的接口从UserDetailsService更改为JwtUserDetailsService,因为我开始从令牌而不是从db获取权限和角色

但开始出现以下异常

Caused by: org.springframework.beans.FatalBeanException: A dependency cycle was detected when trying 
to resolve the AuthenticationManager. Please ensure you have configured authentication.
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$AuthenticationManagerDelegator.validateBeanCycle(WebSecurityConfigurerAdapter.java:553)
这是WebSecurity配置类