1、后台报错

Description:

The dependencies of some of the beans in the application context form a cycle:

   kubeServiceController defined in file [E:\cnsec\web-backend\target\classes\com\venustech\containersecurity\backend\assets\controller\KubeServiceController.class]
┌─────┐
|  kubeServiceServiceImpl defined in file [E:\cnsec\web-backend\target\classes\com\venustech\containersecurity\backend\assets\service\impl\KubeServiceServiceImpl.class]
↑     ↓
|  podServiceImpl defined in file [E:\cnsec\web-backend\target\classes\com\venustech\containersecurity\backend\assets\service\impl\PodServiceImpl.class]
└─────┘

2、报错原因

是因为两个实现类都使用了@RequiredArgsConstructor,采用了构造器注入,导致A引入了B,B又引入了A,导致循环依赖注入报错。

3、解决方法

使用@Autowired注解采用setter方法注入即可。

GitHub 加速计划 / de / Dependencies
42
2
下载
A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.
最近提交(Master分支:4 个月前 )
1997a400 - 4 年前
2f423539 - 4 年前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐