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

相关内容

热门资讯

专业讨论(线上wpk德州ai机... 1、专业讨论(线上wpk德州ai机器人)德州之星有什么诀窍(固有是真的有挂)-哔哩哔哩;详细教程。2...
玩家必看“wpk最新黑科技”w... 玩家必看“wpk最新黑科技”wpk辅助透视教学(wPK)都是有挂(有挂规律)-哔哩哔哩1、实时wpk...
玩家必用!微扑克辅助工具,微扑... 玩家必用!微扑克辅助工具,微扑克ai机器人(微扑克)竟然是有挂(了解有挂)-哔哩哔哩1、下载好微扑克...
黑科技教学“wepoke透明黑... 黑科技教学“wepoke透明黑科技”wepoke有假吗(软件透明挂)切实是真的有挂(有挂总结)-哔哩...
重要通知!微扑克游戏辅助器,微... 重要通知!微扑克游戏辅助器,微扑克有挂么(微扑克)其实是有挂(真是有挂)-哔哩哔哩1、每一步都需要思...
一分钟带你了解(德州ai软件购... 一分钟带你了解(德州ai软件购买)德州之星插件(切实是真的有挂)-哔哩哔哩;最新版2024是一款经典...
科技通报!“wpk到底有没有外... 科技通报!“wpk到底有没有外挂”wpk辅助效果实测(wPk)好像真的有挂(有挂辅助)-哔哩哔哩是一...
详细说明!微扑克ai软件,微扑... 详细说明!微扑克ai软件,微扑克透牌(微扑克)一直有挂(有挂方略)-哔哩哔哩;1、很好的工具软件,可...
黑科技辅助“wepoke辅助插... 黑科技辅助“wepoke辅助插件”wepoke黑科技靠谱吗(黑科技ai)一直是有挂(确实有挂)-哔哩...
分享给玩家(德州ai软件购买)... 分享给玩家(德州ai软件购买)德州之星透牌器(好像是有挂)-哔哩哔哩;德州之星透牌器黑科技是一款具有...