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

相关内容

热门资讯

透视软件“pokemmo内置修... 透视软件“pokemmo内置修改器”哈糖大菠萝有挂吗(透视)力荐教程(总是真的有挂);1、超多福利:...
辅助透视!德普之星透视辅助软件... 辅助透视!德普之星透视辅助软件激活码(透视)辅助软件(有挂工具)德普之星透视辅助软件激活码辅助器中分...
透视有挂“哈糖大菠萝可以开挂吗... 透视有挂“哈糖大菠萝可以开挂吗”xpoker透视辅助(透视)微扑克教程(竟然有挂)1、玩家可以在哈糖...
辅助透视!德普之星app安卓版... 辅助透视!德普之星app安卓版破解版(透视)透视辅助插件(有挂揭秘)1、德普之星app安卓版破解版系...
透视规律!aapoker怎么拿... 透视规律!aapoker怎么拿好牌(透视)aapoker透视脚本,wpk教程(有挂介绍)1、任何aa...
透视数据“pokemmo脚本辅... 透视数据“pokemmo脚本辅助下载”pokemmo手机版脚本免费(透视)力荐教程(好像真的是有挂)...
透视新版!aapoker能控制... 透视新版!aapoker能控制牌吗(透视)aapoker公共底牌,靠谱教程(有挂细节)aapoker...
透视攻略!德普之星透视辅助软件... 透视攻略!德普之星透视辅助软件是真的吗(透视)私人局辅助器(有挂脚本);1)德普之星透视辅助软件是真...
透视数据“pokemmo脚本辅... 透视数据“pokemmo脚本辅助器”哈糖大菠萝有挂吗5个常用方法(透视)细节揭秘(真是真的是有挂)哈...
透视游戏!德普之星辅助器(透视... 透视游戏!德普之星辅助器(透视)免费透视(有挂辅助);1、起透看视 德普之星辅助器透明视辅助2、随意...