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

相关内容

热门资讯

第2分钟黑科技!wepoke有... 1、第2分钟黑科技!wepoke有挂吗网上靠谱吗,红龙扑克外挂,揭秘教程(有挂黑科技)(UU pok...
黑科技游戏!wepoke有没有... 黑科技游戏!wepoke有没有辅助挂,(wepoke)好像存在有挂,大神讲解(有挂黑科技)1、完成w...
透视辅助!德州免费辅助神器ap... 透视辅助!德州免费辅助神器app,德州ai辅助外挂,详细教程(有挂方法);1、许多玩家不知道德州免费...
wepoke辅助机器人!德扑软... wepoke辅助机器人!德扑软件决策,德州之星辅助挂,玩家教程(真是是真的有挂);亲真的是有正版授权...
黑科技苹果版!wepoke辅助... 黑科技苹果版!wepoke辅助,(WePoKer)ai代打,辅助教程(有挂解密);1、下载好wepo...
第一分钟黑科技!德扑ai智能,... 1、第一分钟黑科技!德扑ai智能,wepoke透明挂辅助软件是真的吗,技巧教程(有挂黑科技)(UU ...
透视辅助!微扑克有机器人吗,微... 透视辅助!微扑克有机器人吗,微扑克辅助透视技能教程,透明挂教程(有挂攻略);1、微扑克辅助透视技能教...
wepoke辅助软件靠谱吗!德... 您好,德州辅助软件线上这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很多玩家在...
五分钟黑科技!德扑ai软件购买... 五分钟黑科技!德扑ai软件购买,wepower俱乐部能胜率吗,规律教程(有挂黑科技);支持多人共享记...
黑科技详情!wepoke软件能... 黑科技详情!wepoke软件能玩吗,(WepOke)辅助挂,科技教程(有挂脚本)1、上手简单,内置详...