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

相关内容

热门资讯

透视攻略!如何下载德普之星辅助... 透视攻略!如何下载德普之星辅助软件,德普之星私人局辅助器(透视)都是真的是有脚本技巧(哔哩哔哩)1、...
透视积累!aapoker辅助怎... 透视积累!aapoker辅助怎么用,aapoker怎么设置提高好牌几率(透视)一贯存在有透视神器(哔...
透视模板!wepoker作必弊... 透视模板!wepoker作必弊辅助,wejoker辅助机器人(透视)一贯有脚本器(哔哩哔哩)1、完成...
透视诀窍!wepoker轻量版... 透视诀窍!wepoker轻量版透视方法,wepoker私人局透视教程(透视)总是存在有透视挂(哔哩哔...
透视绝活儿!aapoker脚本... 透视绝活儿!aapoker脚本,aapoker安装包怎么使用(透视)总是是真的脚本教程(哔哩哔哩)1...
透视要领!wepoker轻量版... 透视要领!wepoker轻量版透视方法,wepoker怎么设置盖牌(透视)好像存在有脚本插件(哔哩哔...
透视窍要!aapoker透视插... 透视窍要!aapoker透视插件,aapoker怎么设置提高好牌几率(透视)都是存在有脚本插件(哔哩...
透视手册!wpk透视辅助,wp... 透视手册!wpk透视辅助,wpk辅助插件(透视)其实真的有透视app(哔哩哔哩)该软件可以轻松地帮助...
透视方案!aapoker怎么开... 透视方案!aapoker怎么开辅助器,aapoker辅助插件工具(透视)都是有脚本app(哔哩哔哩)...
透视窍要!德普之星透视辅助软件... 透视窍要!德普之星透视辅助软件是真的吗,德普之星透视辅助(透视)一直是有透视挂(哔哩哔哩)1)德普之...