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

相关内容

热门资讯

黑科技苹果版!微扑克代打是真的... 黑科技苹果版!微扑克代打是真的吗(黑科技)太坑了有挂(技巧教程黑科技解说)-哔哩哔哩;1、起透看视 ...
黑科技辅助挂!wepoke有透... 黑科技辅助挂!wepoke有透视挂吗,wepoke辅助机器人,解密教程(有挂总结)-哔哩哔哩(1)黑...
黑科技工具(微扑克透明挂)外挂... 黑科技工具(微扑克透明挂)外挂黑科技辅助app(透视)一直真的是有挂(黑科技技巧)-哔哩哔哩;1、黑...
黑科技存在"wepo... 黑科技存在"wepoke透明好友局"来玩app辅助(好像存在有挂)-哔哩哔哩wepoke透明好友局辅...
黑科技科技!wepower外挂... 黑科技科技!wepower外挂检测方法(ai代打)太坑了真的是有挂(透明教程黑科技细节)-哔哩哔哩;...
黑科技插件!微扑克有辅助挂吗,... 黑科技插件!微扑克有辅助挂吗,wpk真的有外挂,系统教程(有挂教学)-哔哩哔哩1、这是跨平台的微扑克...
黑科技玄学(wepoke辅助器... 黑科技玄学(wepoke辅助器真的有效果吗)外挂透视辅助下载(透视)都是真的有挂(黑科技解密)-哔哩...
黑科技数据"微扑克a... 黑科技数据"微扑克ai辅助"来玩德州辅助器(真是存在有挂)-哔哩哔哩;1、进入游戏-大厅左侧-新手福...
黑科技智能ai!微扑克透牌(a... 黑科技智能ai!微扑克透牌(ai辅助)太坑了真的有挂(曝光教程黑科技细节)-哔哩哔哩1、下载好微扑克...
黑科技辅助挂!aapoker有... 1、黑科技辅助挂!aapoker有挂吗,德州ai辅助软件,细节方法(有挂辅助挂)-哔哩哔哩;代表性(...