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

相关内容

热门资讯

wepokeai代打!wepo... wepokeai代打!wepoke计算辅助(WePoKe黑科技)切实真的有挂(竟然有挂)-哔哩哔哩;...
一分钟揭秘(德州辅助神器软件)... 一分钟揭秘(德州辅助神器软件)德州ai购买(原先是有挂)-哔哩哔哩,亲,有的,ai轻松简单,又可以获...
Wpk最新黑科技!wpk发牌为... Wpk最新黑科技!wpk发牌为什么这么离谱(WPK ai辅助)往昔真的是有挂(2022已更新)(哔哩...
必备辅助推荐"aap... 必备辅助推荐"aapoker辅助工具ai"aapoker辅助工具ai(一直真的有挂)-哔哩哔哩1、金...
wepoke黑科技!wepok... wepoke黑科技!wepoke到底有没有挂(WePoKe黑科技)其实是真的有挂(有挂功能)-哔哩哔...
每日必看推荐(德州ai辅助神器... 每日必看推荐(德州ai辅助神器软件)德州ai辅助app(从前存在有挂)-哔哩哔哩;科技安装教程;13...
WPK最新黑科技!wpk有没有... WPK最新黑科技!wpk有没有作弊(WPK ai辅助)原本是有挂(2022已更新)(哔哩哔哩)是一款...
记者爆料"aapok... 记者爆料"aapoker发牌机制"aapoker辅助器是真的吗(好像存在有挂)-哔哩哔哩1、每一步都...
wepoke真的有挂!wepo... wepoke真的有挂!wepoke辅助真的假的(WePoKe黑科技)确实是有挂(有挂教学)-哔哩哔哩...
一分钟了解(德州辅助神器软件)... 一分钟了解(德州辅助神器软件)德州之星辅助器多少钱(真是存在有挂)-哔哩哔哩1、很好的工具软件,可以...