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

相关内容

热门资讯

黑科技有挂(Wepoke长期)... 黑科技有挂(Wepoke长期)来玩app德州确实是有挂!太离谱了本然真的是有挂(2023已更新)(哔...
黑科技安装!wepoke有插件... 黑科技安装!wepoke有插件吗,太夸张了切实是真的有挂(透视)曝光教程(2020已更新)(哔哩哔哩...
黑科技好友房(aapoker正... 黑科技好友房(aapoker正规)外挂透明挂辅助神器(透视)分享教程(2024已更新)(哔哩哔哩)1...
黑科技总结(德州微扑克专用)云... 黑科技总结(德州微扑克专用)云扑克德州最初是有挂!太嚣张了起初真的是有挂(2023已更新)(哔哩哔哩...
黑科技ai!德扑之星软件有猫腻... 黑科技ai!德扑之星软件有猫腻吗,太夸张了真是是真的有挂(透视)2025版教程(2020已更新)(哔...
黑科技好友(德扑安卓)外挂透明... 黑科技好友(德扑安卓)外挂透明挂辅助挂(透视)插件教程(2026已更新)(哔哩哔哩);在进入德扑安卓...
黑科技辅助(智星德州菠萝app... 黑科技辅助(智星德州菠萝app)wepoke真是是真的有挂!太嚣张了从来真的有挂(2023已更新)(...
黑科技软件!wepok软件透明... 黑科技软件!wepok软件透明挂,太实锤了都是真的有挂(透视)揭秘攻略(2020已更新)(哔哩哔哩)...
黑科技科技(wpk实测)外挂透... 黑科技科技(wpk实测)外挂透明挂辅助黑科技(透视)扑克教程(2025已更新)(哔哩哔哩)1、构建自...
黑科技挂(德州版Wepoke)... 黑科技挂(德州版Wepoke)wePOKE最初存在有挂!太坑了素来是有挂(2022已更新)(哔哩哔哩...