我试图让Eureka设置为使用 Cloud 配置服务器,但Eureka服务器无法在启动时找到configserver的实例:

WARN 17584 --- [           main] lientConfigServiceBootstrapConfiguration : No instances found of configserver (CONFIGSERVER)

不确定我在配置方面缺少什么 . 配置服务器如下:

bootstrap.yml

spring:
  application:
    name: configserver

application.yml

spring:
  profiles: dev

  cloud:
    config:
      server:
        git:
          uri: https://XXXXXXX/config.git
          username: XXXXXXX
          password: XXXXXXX

server:
  port: 9999

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:9998/eureka/

开始配置为bootstrap.yml(1)的发现服务 . 似乎当configserver注册时,发现服务应该能够检索其配置并正确启动,但是发现服务无法完全启动,并且配置服务器永远无法注册 . 当我在bootstrap.yml(2)中添加其他配置时,两个服务都会启动,但发现服务从不使用配置服务器来检索其配置(discoveryservice.yml) . 如果我提供spring.cloud.config.uri属性,则发现服务将启动并按预期从服务器检索其配置 . 让我觉得我错过了什么,或者在没有配置服务器uri的情况下Eureka无法从配置服务器检索其配置?

bootstrap.yml(1)

spring:
  application:
    name: discoveryservice

---

spring:
  profiles: dev

  cloud:
    config:
      discovery:
        enabled: true

bootstrap.yml(2)

spring:
  application:
    name: discoveryservice

---

spring:
  profiles: dev

  cloud:
    config:
      discovery:
        enabled: true

server:
  port: 9998

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

discoveryservice.yml(来自配置服务器git repo):

server:
  port: 9998

---

spring:
  profiles: dev

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/