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、每一步...
迎来新发展!德普之星透视辅助软... 迎来新发展!德普之星透视辅助软件下载(透视)德普之星app安卓版破解版-真是是有挂(哔哩哔哩)1、首...
透视安装!微乐安徽小程序辅助,... 透视安装!微乐安徽小程序辅助,微乐小程序免费黑科技,妙计教程(有挂软件)-哔哩哔哩1、完成微乐小程序...
2026版规律!hhpoker... 2026版规律!hhpoker软件可以玩吗(透视)hhpoker可以控制吗-竟然是有挂(哔哩哔哩)1...
更值得关注的是!小程序微乐辅助... 更值得关注的是!小程序微乐辅助器ios,微乐小程序免费黑科技,妙计教程(有挂工具)-哔哩哔哩1、用户...
经调查!竞技联盟破解版最新版(... 经调查!竞技联盟破解版最新版(透视)哈糖大菠萝破解器-原来有挂(哔哩哔哩)1、打开软件启动之后找到中...
据公告内容!微信小程序微乐家乡... 据公告内容!微信小程序微乐家乡辅助器,微乐小程序黑科技,资料教程(有挂工具)-哔哩哔哩1、游戏颠覆性...
透视安卓版!wpk俱乐部是做什... 透视安卓版!wpk俱乐部是做什么的(透视)wpk俱乐部辅助器-竟然真的有挂(哔哩哔哩)1、起透看视 ...
据相关数据显示!微乐小程序晃晃... 据相关数据显示!微乐小程序晃晃脚本,微乐小程序黑科技,手段教程(有挂安装)-哔哩哔哩1、首先打开微乐...
透视软件!wepoker破解器... 透视软件!wepoker破解器有用吗(透视)wepoker透视方法-本来有挂(哔哩哔哩)1、不需要A...