【发布时间】:2017-01-06 00:47:06
【问题描述】:
我想尝试什么:
我想为微服务项目尝试spring cloud config,其中我有一个用于所有服务的common config 和一个用于每个服务的multiple configs。
我知道如何使用spring.profiles.active 和include 来使用多个profiles。我想了解如何在配置客户端上加载多个配置?
我有什么:
在我的 git 存储库中,我有 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,对于产品微服务,我需要'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 访问属性。
我的问题:
问题1:
如何在orderclient 应用程序中访问jmsclient.yml,productclient.yml 的属性。
问题2:
无论如何要获取配置服务器公开的所有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
....}
如果我的问题不清楚或需要更多信息,请告诉我。谢谢。
【问题讨论】:
标签: java microservices spring-cloud-config