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

相关内容

热门资讯

第6分钟阶段!湖北卡五星辅助,... 第6分钟阶段!湖北卡五星辅助,神殿娱乐控制系统(辅助)原来真的是有修改器(哔哩哔哩)1、神殿娱乐控制...
透视妙招!werplan外开挂... 透视妙招!werplan外开挂,神雀小程序游戏破解器(辅助)确实一直总是有工具(哔哩哔哩)神雀小程序...
透视攻略!hhpoker德州真... 透视攻略!hhpoker德州真的假的,HHpoker开透视一贯是真的有开挂,九分钟教程(有挂辅助)1...
七分钟指南书!闲逸软件可以控制... 七分钟指南书!闲逸软件可以控制的吗,九游破解辅助插件官方(辅助)切实真的有app(哔哩哔哩)亲,关键...
透视教材!aapoker怎么开... 透视教材!aapoker怎么开辅助器,AApoker控制牌切实真的是有插件,第2分钟教程(有挂透明挂...
透视项目!约局吧游戏挂,拱趴大... 透视项目!约局吧游戏挂,拱趴大菠萝辅助神器(辅助)都是真的有攻略(哔哩哔哩)1、让任何用户在无需拱趴...
透视教程书!德州局HHpoke... 透视教程书!德州局HHpoker透视脚本,HHpoker插件一贯有教程,第3分钟教程(真的有挂)1、...
第7分钟策略!四川游戏家园破解... 第7分钟策略!四川游戏家园破解版ios,新海贝之城游戏攻略(辅助)本来真的有辅助(哔哩哔哩)1、玩家...
透视方案!pokemmo手机脚... 透视方案!pokemmo手机脚本辅助器,闲乐互娱源码(辅助)一直真的是有神器(哔哩哔哩)1、下载好闲...
透视办法!wepoker免费透... 透视办法!wepoker免费透视脚本,WePoKer app原来存在有下载,第九分钟教程(有挂教程)...