首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring cloud config client无法定位PropertySource

Spring cloud config client无法定位PropertySource
EN

Stack Overflow用户
提问于 2018-07-28 00:18:56
回答 1查看 6.7K关注 0票数 1

我的配置服务器使用natie文件系统工作正常,开发人员配置文件配置为contextPath: /config

代码语言:javascript
复制
spring:
  application:
    name: dcit-config
  profiles:
    active: native

management:
  endpoints:
    web:
      exposure:
        include: info, health, metrics
  metrics:
    export:
      atlas:
        enabled: true

---
spring:
  profiles: native
  application:
    name: dcit-config
  cloud:
    config:
      server:
        native:
          searchLocations: classpath:/config/
server:
  port: 2003
eureka:
  instance:
    prefer-ip-address: true
    lease-renewal-interval-in-seconds: 5
    lease-expiration-duration-in-seconds: 20
  client:
    serviceUrl:
      defaultZone: http://dcit:dcit@localhost:1023/eureka
    registry-fetch-interval-seconds: 10

---
spring:
  profiles: dev
  application:
    name: dcit-config
  cloud:
    config:
      server:
        git:
          uri: http://xxx/git/Arch/dcit.git
          username: user
          password: pass
          searchPaths: dcit-config/src/main/resources/config/
          clone-on-start: true
      fail-fast: true
server:
  port: 2002
  contextPath: /config
eureka:
  instance:
    prefer-ip-address: true
    lease-renewal-interval-in-seconds: 5
    lease-expiration-duration-in-seconds: 20
  client:
    serviceUrl:
      defaultZone: http://dc:dc@localhost:1023/eureka
    registry-fetch-interval-seconds: 10

本机配置文件服务器配置如下:http://hostname:2003/config/app-profile.yml和我的客户端运行良好。

但是,如果我使用开发配置文件,url http://hostname:2002/config/app-profile.yml也可以工作,但是我的客户机得到错误: java.lang.IllegalStateException:找不到PropertySource,并且设置了快速失败属性,失败。

我的客户端配置:

代码语言:javascript
复制
spring:
  application:
    name: dcit-auth
  profiles:
    active: dev
  cloud:
    config:
      fail-fast: true
      discovery:
        service-id: dcit-config
        enabled: true
      profile: ${spring.profiles.active}
      label: ${spring.profiles.active}

---
spring:
  profiles: dev
eureka:
  instance:
    prefer-ip-address: true
    lease-renewal-interval-in-seconds: 5
    lease-expiration-duration-in-seconds: 20
  client:
    serviceUrl:
      defaultZone: http://dc:dc@localhost:1023/eureka
    registry-fetch-interval-seconds: 10
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-14 23:01:47

通过删除contextPath: /config和label configure解决

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51561886

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档