14

我想尝试的:

我想尝试spring cloud config微服务项目,我有一个common config适用于所有服务和multiple configs每个服务的项目。
我知道如何使用多个profilesusingspring.profiles.activeinclude. 我想了解如何在配置客户端上加载多个配置?

我有的:

在我的 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
 ....}

如果我的问题不清楚或需要更多信息,请告诉我。谢谢。

4

1 回答 1

21

spring.cloud.config.name您可以使用属性设置要加载的配置的逗号分隔列表:

spring.cloud.config.name: jmsclient,productclient,orderclient
于 2016-10-21T15:24:41.057 回答