maven项目中springcloud中的健康检查spring-boot-starter-actuator和jdbc之间形成循环依赖

maven项目循环依赖的问题困扰很长时间

错误代码

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
└─────┘

此问题主要是版本问题一开始用的依赖版本如下

<parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.0.1.RELEASEversion>
    parent>

解决方式把2.0.1.RELEASE改成2.0.2.RELEASE,循环问题解决了

你可能感兴趣的:(maven项目中springcloud中的健康检查spring-boot-starter-actuator和jdbc之间形成循环依赖)