Relying upon circular references is discouraged and they are prohibited by default.
创始人
2024-11-15 18:38:13
0

Relying upon circular references is discouraged and they are prohibited by default.

创建springboot项目时,使用的版本是2.7.13,运行项目时报错

image-20230810125918536

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.

直接翻译过来的话就是:

不鼓励依赖循环引用,并且默认情况下禁止循环引用。更新应用程序以删除bean之间的依赖循环。作为最后的手段,可以通过设置spring.main来自动打破这个循环。允许循环引用为true。

image-20230810125952840

解决方案

提示中已经把解决方案说了 setting spring.main.allow-circular-references to true.

在springboot2.6正式发布,循环依赖默认静止了。我们只需要开启就行

如果是 properties 配置文件

spring.main.allow-circular-references=true 

如果是 yml 配置文件

spring:   main:     allow-circular-references:true 

我这里是 yml配置,加上后重启就正常运行了

image-20230810130802562

相关内容

热门资讯

黑科技辅助!wepoke透明挂... 黑科技辅助!wepoke透明挂在哪买(透视)软件透明挂ai辅助器(一直真的是有挂)-哔哩哔哩,wep...
黑科技辅助!红龙扑克会作假(透... 黑科技辅助!红龙扑克会作假(透视)软件透明挂ai辅助工具(本来是真的有挂)-哔哩哔哩;最新版2026...
黑科技辅助!wepoke是有挂... 黑科技辅助!wepoke是有挂软件(透视)先前真的是有挂(有挂方式)-哔哩哔哩;1、完成wepoke...
黑科技辅助!红龙扑克辅助器第一... 黑科技辅助!红龙扑克辅助器第一视角(透视)软件透明挂ai辅助器(竟然存在有挂)-哔哩哔哩;黑科技辅助...
黑科技辅助!wepoke真的有... 黑科技辅助!wepoke真的有挂嘛(透视)都是存在有挂(有挂工具)-哔哩哔哩;是一款可以让一直输的玩...
黑科技辅助!德州ai辅助可以打... 黑科技辅助!德州ai辅助可以打(透视)软件透明挂ai辅助软件(素来有挂)-哔哩哔哩;1、让任何用户在...
黑科技辅助!智星菠萝德州辅助器... 黑科技辅助!智星菠萝德州辅助器(透视)原生真的有挂(详细教程)-哔哩哔哩是一款可以让一直输的玩家,快...
黑科技辅助!wpk透视辅助(透... 黑科技辅助!wpk透视辅助(透视)软件透明挂ai辅助安装(原来有挂)-哔哩哔哩;wpk透视辅助是一种...
黑科技辅助!poker外挂(透... 黑科技辅助!poker外挂(透视)素来真的是有挂(有挂详情)-哔哩哔哩;AI辅助机器人普及解说快速成...
黑科技辅助!pokerworl... 黑科技辅助!pokerworld软件(透视)软件透明挂ai辅助安装(竟然真的是有挂)-哔哩哔哩;1、...