![](/img/trans.png)
[英]How to use spring cloud config server with postgresql and jdbc as backend with multiple profiles?
[英]spring cloud config : how to use multiple configs
我想尝试针对微服务项目的spring cloud config
,其中我为每个服务提供了所有服务和multiple configs
的common config
。
我知道如何使用spring.profiles.active
和include
来使用多个profiles
。 我试图了解如何在配置客户端上加载多个配置?
在我的git repo中,我有spring-config-repo
,我有......
application.yml
orderclient.yml
subscriberclient.yml
jmsclient.yml
productclient.yml
我的config Server
指向我的配置仓库。
spring:
application:
name: config-service
cloud:
config:
server:
git:
uri: https://github.com/<user>/spring-config-repo
server:
port: 8888
我有我的spring client
,我想使用多个配置。 在我的orderService
案例中,我想加载application.yml,orderclient.yml,jmsconfig.yml
和For Product microService我需要'orderconfig.yml,jmsclient.yml,productclient.yml'
spring:
application:
name: orderclient
profiles:
active: test
cloud:
config:
uri: http://localhost:8888
###Any kind of config properties to load jmsclient, productclient?
上面我可以从orderclient.yml访问属性。
如何在orderclient
应用程序中访问jmsclient.yml,productclient.yml
的orderclient
。
反正有没有得到配置服务器公开的所有propertySources.name
列表? 在上述情况下,它应该显示出来
"propertySources": {
"name": "https://github.com/<>/spring-config-repo/aplication.yml",
"profiles": <available profiles for this say> Dev, Test,
"name": "https://github.com/<>/spring-config-repo/orderclient.yml",
"profiles": <available profiles for this say> Dev, Test
"name": "https://github.com/<>/spring-config-repo/jmsclient.yml",
"profiles": <available profiles for this say> Dev, Test
....}
如果我的问题不明确或需要更多信息,请告诉我。 谢谢。
您可以使用spring.cloud.config.name
属性设置要加载的逗号分隔的配置列表:
spring.cloud.config.name: jmsclient,productclient,orderclient
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.