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

相关内容

热门资讯

辅助透视!we poker游戏... 辅助透视!we poker游戏下,wepoker钻石怎么看底牌,竟然一直总是有辅助教程(哔哩哔哩)1...
突发!福建十三时辅助,哥哥打大... 突发!福建十三时辅助,哥哥打大a外g挂(都是真的有平台)-哔哩哔哩1、福建十三时辅助公共底牌简单,福...
科普透视!hhpoker真能买... 科普透视!hhpoker真能买到挂吗,模拟器打开hhpoker,切实有辅助教程(哔哩哔哩)1、下载好...
此事迅速冲上热搜!传送五激k辅... 此事迅速冲上热搜!传送五激k辅助靠谱吗,凑一桌关春天怎么开透视(好像存在有软件)-哔哩哔哩1、凑一桌...
详细透视!aapoker怎么选... 详细透视!aapoker怎么选牌,aapoker怎么选牌,本来是真的有辅助教程(哔哩哔哩)在进入软件...
来临!微乐河南小程序辅助器免费... 来临!微乐河南小程序辅助器免费,微信小程序辅助新天道辅助(确实是真的脚本)-哔哩哔哩微信小程序辅助新...
推荐透视!wepoker透视脚... 推荐透视!wepoker透视脚本免费使用视频,wepoker私人局俱乐部,确实有辅助神器(哔哩哔哩)...
为了进一步!打哈儿床将脚本,衡... 为了进一步!打哈儿床将脚本,衡阳丫丫字牌靠谱吗(真是存在有下载)-哔哩哔哩1、玩家可以在衡阳丫丫字牌...
辅助透视!aapoker怎么选... 辅助透视!aapoker怎么选牌,aa poker透视软件,本来真的有辅助插件(哔哩哔哩)1、许多玩...
值得注意的是!新超圣辅助器,皮... 值得注意的是!新超圣辅助器,皮皮跑胡子有没有挂(原来有挂工具)-哔哩哔哩1、皮皮跑胡子有没有挂公共底...