Java The dependencies of some of the beans in the application context form a cycle问题解决
问题描述:
Description:
The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| asyncService (field private com.xudongbase.test.service.AsyncService2 com.xudongbase.test.service.AsyncService.asyncService2)
↑ ↓
| asyncService2 (field private com.xudongbase.test.service.AsyncService com.xudongbase.test.service.AsyncService2.asyncService)
└─────┘
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.
问题描述:
1、Service使用存在相互依赖的情况,导致启动失败。
解决办法:
使用@org.springframework.context.annotation.Lazy注解延时装配,成功启动。
还没有评论,来说两句吧...