[英]Spring Boot: Load common config application properties file using bootstrap.yml
In our config server we have following application properties files:在我们的配置服务器中,我们有以下应用程序属性文件:
helloApp-dev.properties //dev env properties
helloApp-commonConfig.properties //common properties across env
The properties are accessible from URI like:可以从 URI 访问这些属性,例如:
https://myapp.abc.com/1234/helloApp-dev.properties
https://myapp.abc.com/1234/helloApp-commonConfig.properties
Below is our bootstrap.yml of helloApp application:下面是我们的 helloApp 应用程序的 bootstrap.yml:
---
spring:
application:
name: helloApp
---
spring
profiles: dev
cloud:
config:
label: 1234
name: {spring.application.name}
uri: https://myapp.abc.com/
I am using Spring boot version 2.2.4.我正在使用 Spring 启动版本 2.2.4。 The helloApp-dev.properties are loading successfully in application but not commonConfig. helloApp-dev.properties 在应用程序中成功加载,但不是 commonConfig。
To load properties file, profiles should match.要加载属性文件,配置文件应该匹配。 You have 2 solutions:您有 2 个解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.