我想尝试的:
我想尝试spring cloud config
微服务项目,我有一个common config
适用于所有服务和multiple configs
每个服务的项目。
我知道如何使用多个profiles
usingspring.profiles.active
和include
. 我想了解如何在配置客户端上加载多个配置?
我有的:
在我的 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
,对于产品微服务,我需要'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:
如何访问应用程序jmsclient.yml,productclient.yml
中的属性orderclient
。
问题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
....}
如果我的问题不清楚或需要更多信息,请告诉我。谢谢。