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

相关内容

热门资讯

黑科技规律!微扑克辅助工具怎么... 黑科技规律!微扑克辅助工具怎么下载(透视)外挂透明挂辅助软件(2026已更新)(哔哩哔哩)1、微扑克...
黑科技安卓版!wepower辅... 黑科技安卓版!wepower辅助软件的使用教程(透视)一直存在有挂(2023已更新)(哔哩哔哩);1...
分享实测(wpk德州扑克线上)... 分享实测(wpk德州扑克线上)wepoke ai辅助(2024已更新)(哔哩哔哩)1、任何德州ai辅...
黑科技教程(wepoke智能a... 黑科技教程(wepoke智能ai)wepoke显示有挂(wePOke)从前是真的有挂(真是有挂)-哔...
黑科技黑科技!wpk微扑克辅助... 黑科技黑科技!wpk微扑克辅助ai(透视)都是是真的有挂(2024已更新)(哔哩哔哩);运wpk微扑...
黑科技教程!aapoker到底... 黑科技教程!aapoker到底有挂吗(透视)外挂透明挂辅助神器(2023已更新)(哔哩哔哩)运aap...
我来教教你(wpk德州)微扑克... 我来教教你(wpk德州)微扑克如何让系统发好牌(2025已更新)(哔哩哔哩)是一款可以让一直输的玩家...
黑科技安装(wepoke黑科技... 黑科技安装(wepoke黑科技)wepoke辅助插件好用吗(WePoKer)从前有挂(真的有挂)-哔...
黑科技黑科技挂!德扑ai操作(... 黑科技黑科技挂!德扑ai操作(透视)确实有挂(2026已更新)(哔哩哔哩)1、黑科技黑科技挂!德扑a...
我来分享!微扑克辅助是真的吗(... 我来分享!微扑克辅助是真的吗(透视)外挂透明挂辅助助手(2026已更新)(哔哩哔哩)1)微扑克辅助是...