我希望严格使用领事作为配置源。我正在使用spring-cloud-consul-config来获取我的配置。我使用git2consul将文件加载到领事并读取它们。根据春云文档,我在build.gradle中添加了以下内容
compile ("org.springframework.cloud:spring-cloud-starter-consul-config")并在我的application.properties中有以下内容
spring.application.name=test-service
spring.cloud.consul.config.enabled=true
spring.cloud.consul.enabled=true
spring.cloud.consul.config.format=FILES我面临的问题是,预期的属性没有加载到ConfigurationProperties bean中。在ConsulPropertySourceLocator::locate(Environment环境)方法中的进一步调试中,我看到this.properties对象仍然使用KEY_VALUE枚举加载。
这就引出了ConsulConfigBootstrapConfiguration类,在该类中,ConsulConfigProperties bean是使用构造函数实例化的。
这是问题还是我的设置有问题。如果有人有一个工作设置的git2consul和弹簧云配置,请您指出我的参考。
发布于 2017-07-06 22:33:02
您在application.properties中拥有的这些值
spring.application.name=test-service
spring.cloud.consul.config.enabled=true
spring.cloud.consul.enabled=true
spring.cloud.consul.config.format=FILES需要在bootstrap.properties。
https://stackoverflow.com/questions/44956635
复制相似问题