Spring Security OAuth2 数据源循环依赖问题

最近在做授权、认证,引入了,在启动项目的时候总是在报错,数据源循环依赖问题。

SpringBoot 版本:  2.0.1.RELEASE

Spring Cluoud 版本:Finchley.SR1

使用的是:spring-cloud-starter-oauth2 

错误提示:

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

最后经过验证,是版本问题,经过查询,SpringBoot 2.0有这个问题,在2.1之后就解决了这个问题

最后引入了版本:

SpringBoot 版本:  2.1.4.RELEASE

Spring Cluoud 版本:Greenwich.RELEASE

成功解决了数据源循环依赖的问题。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章