点题:【BUG调试】项目启动循环依赖问题 The dependencies of some of the beans in the application context form a cycle
在新建的spring-boot项目启动时出现一个错误,报错/问题截图如下:
The dependencies of some of the beans in the application context form a cycle
二,问题处理:
在项目工程的.yml文件添加一段禁止加载循环依赖的显示设置,设置代码如下:
spring:
main:
allow-circular-references:true
如果是以.properties为后缀名的配置文件,可在文件中添加代码如下:
spring.main.allow-circular-references = true
二者选其一即可,在我的工程是。yml文件配置:
保存设置重启项目就OK啦:
寻找循环依赖报错出现的原因:
在pom.yml 配置文件里的值为某些xxx-xxx-boot-starter的主依赖里面包含有已经需要引用的依赖了。因此,删除在pom.yml的重复依赖的引用即可。
我的报错情况举例如下:
删除上面这个即可。其他的有报循环依赖的情况处理同理。