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.
I got idea on how to use multiple profiles
using spring.profiles.active
and include
. 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 ...
application.yml
orderclient.yml
subscriberclient.yml
jmsclient.yml
productclient.yml
I have my config Server
pointed to my config repo.
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. 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'
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.
How to access properties of jmsclient.yml,productclient.yml
in orderclient
application.
Is there anyway to get list of all propertySources.name
exposed by config server? 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.