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

相关内容

热门资讯

透视详情!拱趴大菠萝万能挂图解... 透视详情!拱趴大菠萝万能挂图解,哈糖大菠萝开挂-确实是真的有辅助工具(哔哩哔哩)在进入拱趴大菠萝万能...
透视曝光!wepokerplu... 透视曝光!wepokerplus万能挂,wepoker轻量版透视-其实一直总是有辅助app(哔哩哔哩...
透视解谜!wepoker手机助... 透视解谜!wepoker手机助手,wepoker透视app下载-本来是有辅助神器(哔哩哔哩)1、ep...
透视解谜!wepoker破解器... 透视解谜!wepoker破解器有用吗,wepoker辅助器安装包定制-好像是有辅助攻略(哔哩哔哩)1...
透视必备!wepoker破解工... 透视必备!wepoker破解工具,wepoker有没有机器人-切实是真的有辅助方法(哔哩哔哩)1、破...
透视推荐!wepoker私人局... 透视推荐!wepoker私人局透视,wepoker怎么下载游戏-竟然真的是有辅助方法(哔哩哔哩)1)...
透视分享!wepoker正确养... 透视分享!wepoker正确养号方法,wepoker透视脚本免费下载pc-一贯是有辅助神器(哔哩哔哩...
透视解密!wepoker代打辅... 透视解密!wepoker代打辅助机器人,wepokerplus透视脚本免费-切实有辅助插件(哔哩哔哩...
透视分享!wpk模拟器多开,w... 您好,这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多玩家在这款游戏中打...
透视推荐!aapoker怎么控... 透视推荐!aapoker怎么控制牌,aapoker真的假的-其实存在有辅助工具(哔哩哔哩)1、完成辅...