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

相关内容

热门资讯

据统计!微乐家乡官方app下载... 据统计!微乐家乡官方app下载,微乐小程序黑科技,步骤教程(有挂神器)-哔哩哔哩所有人都在同一条线上...
一分钟插件!微乐麻将自建房ap... 一分钟插件!微乐麻将自建房app,微乐小程序免费黑科技,技法教程(有挂修改器)-哔哩哔哩微乐小程序免...
不少玩家反映!微信小程序多乐辅... 不少玩家反映!微信小程序多乐辅助器,微乐小程序免费黑科技,课程教程(有挂神器)-哔哩哔哩在进入微信小...
第6分钟安装!微乐小程序透视工... 第6分钟安装!微乐小程序透视工具,微乐小程序免费黑科技,技法教程(有挂辅助器)-哔哩哔哩1、微乐小程...
透视有挂!微乐自建房道具有用吗... 透视有挂!微乐自建房道具有用吗,微乐小程序免费黑科技,窍门教程(有挂神器)-哔哩哔哩1、金币登录送、...
一分钟插件!微乐小程序脚本入口... 一分钟插件!微乐小程序脚本入口,微乐小程序黑科技,举措教程(有挂辅助器)-哔哩哔哩;1、该软件可以轻...
透视软件!微信小程序微乐修改器... 透视软件!微信小程序微乐修改器,微乐小程序免费黑科技,烘培教程(有挂安装)-哔哩哔哩微信小程序微乐修...
第7分钟辅助!微乐小程序有脚本... 第7分钟辅助!微乐小程序有脚本,微乐小程序免费黑科技,教程书教程(有挂软件)-哔哩哔哩1、每一步都需...
透视游戏!微乐小程序破解版修改... 透视游戏!微乐小程序破解版修改器,微乐小程序黑科技,大纲教程(有挂工具)-哔哩哔哩1、微乐小程序破解...
第四分钟插件!微乐小程序挂哪里... 第四分钟插件!微乐小程序挂哪里有,微乐小程序免费黑科技,项目教程(有挂修改器)-哔哩哔哩1、上手简单...