【问题标题】:spring cloud consul config ignored for profilespring cloud consul config 忽略配置文件
【发布时间】:2017-12-07 18:26:02
【问题描述】:

我的 spring boot 2.0 应用程序在 bootstrap.yml 中有以下条目 如果我使用配置文件 stage4 运行,则会加载配置值,即无法从 localhost1 启动。

如果我使用开发配置文件运行,这些值将被忽略,即 consul 以 localhost 开头,而不是 localhost2 失败。任何指针?


spring:
   profiles: dev
   cloud:
    consul:
      host: localhost2
      port: 8500
      config:
        prefix: config
        defaultContext: myapp/dev

spring: profiles: stage cloud: consul: host: localhost1 port: 8500 config: prefix: config defaultContext: myapp/stage

【问题讨论】:

    标签: spring config profile consul


    【解决方案1】:

    好的,通过将阶段属性移动到 bootstrap-stage.yml 解决了这个问题

    【讨论】:

      猜你喜欢
      • 2016-02-18
      • 1970-01-01
      • 2015-01-03
      • 2016-07-12
      • 2022-10-19
      • 2022-12-04
      • 1970-01-01
      • 1970-01-01
      • 2018-07-14
      相关资源
      最近更新 更多