Spring
  cloud:
    refresh:
      refreshable: none

以上为解决办法。

我在部署item-service,当时没有添加 spring-boot-starter-actuator 依赖,导致微服务不能被检测到,后来加了这个依赖之后,出现如下问题:

org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'scopedTarget.dataSource': Requested bean is currently in creation: Is there an unresolvable circular reference?

而且一直生成

============================
CONDITIONS EVALUATION REPORT
============================ 

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

用idea查看依赖关系图,有多处报红线,显示依赖有问题,所以在application.yml文件中加入开头的配置,就好了。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐