简体   繁体   English

配置文件忽略了Spring Cloud Consul配置

[英]spring cloud consul config ignored for profile

I have following entries in bootstrap.yml for my spring boot 2.0 app If I run with profile stage4 the config values are loaded ie fails to start at localhost1. 我在springtrap 2.0应用程序的bootstrap.yml中有以下条目:如果我使用配置文件stage4运行,则配置值已加载,即无法从localhost1启动。

Where as if I run with dev profile these values are ignored ie consul starts with localhost instead of failing for localhost2. 好像我使用开发配置文件运行时,这些值将被忽略,即领事以localhost开始而不是localhost2失败。 any pointers? 有指针吗?


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

可以通过将舞台属性移动到bootstrap-stage.yml来解决此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM