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

相关内容

热门资讯

黑科技教学!微扑克有挂么,太实... 黑科技教学!微扑克有挂么,太实锤了都是存在有挂(透视)黑科技教程(2020已更新)(哔哩哔哩)1、不...
黑科技app(wpk苹果版)外... 黑科技app(wpk苹果版)外挂透明挂辅助器(透视)玩家教程(2022已更新)(哔哩哔哩);wpk苹...
黑科技科技(aapoker记牌... 黑科技科技(aapoker记牌器)太无语了固有是真的有挂(透视)技巧教程(2020已更新)(哔哩哔哩...
黑科技最新(aapoker)外... 1、黑科技最新(aapoker)外挂透明挂黑科技辅助软件(透视)黑科技教程(2021已更新)(哔哩哔...
黑科技真的!wepoke软件透... 黑科技真的!wepoke软件透明挂,太离谱了原来是真的有挂(透视)解密教程(2020已更新)(哔哩哔...
黑科技插件(Wepoke安卓)... 黑科技插件(Wepoke安卓)外挂透明挂辅助app(透视)2025新版教程(2021已更新)(哔哩哔...
黑科技攻略(线上wpk德州ai... 黑科技攻略(线上wpk德州ai机器人)太嚣张了一直有挂(透视)AA德州教程(2020已更新)(哔哩哔...
黑科技透明挂(德州扑克)外挂透... 黑科技透明挂(德州扑克)外挂透明挂黑科技辅助代打(透视)扑克教程(2020已更新)(哔哩哔哩)1、这...
黑科技系统(GG扑克)外挂透明... 黑科技系统(GG扑克)外挂透明挂辅助app(透视)揭秘教程(2020已更新)(哔哩哔哩)1、完成GG...
黑科技安装(微扑克ai辅助神器... 自定义微扑克ai辅助神器系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅助器,不...