这是报错信息
Description:
The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| securityConfig (field private com.xxxx.server.service.IAdminService com.xxxx.server.config.security.SecurityConfig.adminService)
↑ ↓
| adminServiceImpl (field private org.springframework.security.core.userdetails.UserDetailsService com.xxxx.server.service.impl.AdminServiceImpl.userDetailsService)
└─────┘
Action:
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
在其中一个类上加上@Lazy注解,延缓其中一个bean的加载。
eg:在securityConfig中
@Autowired
@Lazy
private IAdminService adminService;