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

相关内容

热门资讯

透视指南!wepoker的辅助... 透视指南!wepoker的辅助器(透视)竟然有辅助插件(哔哩哔哩)1、下载好wepoker的辅助器透...
今天上午!八闽辅助,一直是真的... 今天上午!八闽辅助,一直是真的辅助器(有挂教学)-哔哩哔哩1、每一步都需要思考,不同水平的挑战会更加...
透视教学!哈糖大菠萝有挂吗,丽... 透视教学!哈糖大菠萝有挂吗,丽水双扣茶苑脚本,教材辅助插件(有挂辅助)-哔哩哔哩暗藏猫腻,小编详细说...
解迷透视!约局吧开挂神器是真的... 解迷透视!约局吧开挂神器是真的吗,约局吧怎么看有没有挂(透视)都是一直总是有辅助教程(哔哩哔哩)解迷...
透视绝活!约局吧游戏挂(透视)... 透视绝活!约局吧游戏挂(透视)原来是真的辅助平台(哔哩哔哩)1、许多玩家不知道约局吧游戏挂辅助怎么退...
近期!xpoker怎么作必弊,... 近期!xpoker怎么作必弊,浙江同城游辅助器,操作辅助插件(有挂规律)-哔哩哔哩进入游戏-大厅左侧...
近期!山西扣点点辅助工具,都是... 近期!山西扣点点辅助工具,都是真的有辅助安装(竟然有挂)-哔哩哔哩1、金币登录送、破产送、升级送、活...
了解透视!pokemmo手机版... 了解透视!pokemmo手机版脚本,悦扑克脚本(透视)原来是有辅助脚本(哔哩哔哩)1、pokemmo...
透视窍要!poker worl... 透视窍要!poker world辅助器(透视)原来是真的辅助app(哔哩哔哩)1、poker wor...
刚刚!wepoker辅助,总是... 刚刚!wepoker辅助,总是是真的辅助下载(有挂方式)-哔哩哔哩暗藏猫腻,小编详细说明wepoke...