[英]spring cloud config : how to use multiple configs
I want to try the spring cloud config
for microservice project where I have a common config
for all services and multiple configs
for each service. 我想尝试针对微服务项目的
spring cloud config
,其中我为每个服务提供了所有服务和multiple configs
的common config
。
I got idea on how to use multiple profiles
using spring.profiles.active
and include
. 我知道如何使用
spring.profiles.active
和include
来使用多个profiles
。 I am trying to understand how can I load multiple configs on config client? 我试图了解如何在配置客户端上加载多个配置?
In my git repo I have spring-config-repo
where I have ... 在我的git repo中,我有
spring-config-repo
,我有......
application.yml
orderclient.yml
subscriberclient.yml
jmsclient.yml
productclient.yml
I have my config Server
pointed to my config repo. 我的
config Server
指向我的配置仓库。
spring:
application:
name: config-service
cloud:
config:
server:
git:
uri: https://github.com/<user>/spring-config-repo
server:
port: 8888
I have my spring client
where I want to use multiple configs. 我有我的
spring client
,我想使用多个配置。 Here in my case for orderService
I want to load application.yml,orderclient.yml,jmsconfig.yml
and For Product microService I need 'orderconfig.yml,jmsclient.yml,productclient.yml' 在我的
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?
Above I can access properties from orderclient.yml. 上面我可以从orderclient.yml访问属性。
How to access properties of jmsclient.yml,productclient.yml
in orderclient
application. 如何在
orderclient
应用程序中访问jmsclient.yml,productclient.yml
的orderclient
。
Is there anyway to get list of all propertySources.name
exposed by config server? 反正有没有得到配置服务器公开的所有
propertySources.name
列表? where in above case it should dispaly 在上述情况下,它应该显示出来
"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
....}
Please let me know if my question is not clear or need more information. 如果我的问题不明确或需要更多信息,请告诉我。 Thanks.
谢谢。
您可以使用spring.cloud.config.name
属性设置要加载的逗号分隔的配置列表:
spring.cloud.config.name: jmsclient,productclient,orderclient
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.