openshell 的个人博客

一天很长,但十年很短。

Open Source, Open Mind,
Open Sight, Open Future!
  menu
114 文章
5051 浏览
1 当前访客
ღゝ◡╹)ノ❤️

记一次Spring Boot循环依赖问题


APPLICATION FAILED TO START


Description:

The dependencies of some of the beans in the application context form a cycle:
servletEndpointRegistrar defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.class]

healthEndpoint defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]

org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfiguration
┌ ─ ─ ─ ─ ─ ┐
| dataSource
↑ ↓
| scopedTarget.dataSource defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]
↑ ↓
| org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
└ ─ ─ ─ ─ ─ ┘
遇到个炫酷的bug,百度查找一番,有人说是代码问题,手工检查依赖很麻烦建议使用IDEA图形化检测工具,使用ctrl+alt+shift+u
有位老哥让在配置文件中加入spring.datasource.initialize=false,我当时就惊了,这是把提出需求的人解决了么。。
多次搜索发现是springboot 2.0.1官方bug,更换2.0.4之后的版本即可。

值得一看的文章:https://blog.csdn.net/huangguojun00/article/details/81583993


标题:记一次Spring Boot循环依赖问题
作者:openshell
地址:http://solo.caiqz.cn/articles/2020/04/22/1587519749403.html