Java spring云配置:如何使用多个配置 我想尝试的是:
我想尝试微服务项目的Java spring云配置:如何使用多个配置 我想尝试的是:,java,microservices,spring-cloud-config,Java,Microservices,Spring Cloud Config,我想尝试微服务项目的spring云配置,其中所有服务都有common配置,每个服务都有多个配置。 我知道如何使用多个配置文件使用spring.profiles.active和include。我试图了解如何在配置客户端上加载多个配置 我所拥有的: 在我的git repo中,我有spring配置repo我有 application.yml orderclient.yml subscriberclient.yml jmsclient.yml productclient.yml 我的配置服务器指向我的
spring云配置
,其中所有服务都有common配置
,每个服务都有多个配置。
我知道如何使用多个配置文件使用spring.profiles.active
和include
。我试图了解如何在配置客户端上加载多个配置
我所拥有的:
在我的git repo中,我有spring配置repo
我有
application.yml
orderclient.yml
subscriberclient.yml
jmsclient.yml
productclient.yml
我的配置服务器
指向我的配置repo
spring:
application:
name: config-service
cloud:
config:
server:
git:
uri: https://github.com/<user>/spring-config-repo
server:
port: 8888
上面我可以从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
....}
“不动产资源”:{
“名称”:https://github.com//spring-config-repo/aplication.yml",
“配置文件”:开发、测试、,
“名称”:https://github.com//spring-config-repo/orderclient.yml",
“配置文件”:开发、测试
“名称”:https://github.com//spring-config-repo/jmsclient.yml",
“配置文件”:开发、测试
....}
如果我的问题不清楚或需要更多信息,请告诉我。谢谢。您可以使用spring.cloud.config.name
属性设置要加载的配置的逗号分隔列表:
spring.cloud.config.name: jmsclient,productclient,orderclient
spring.cloud.config.name: jmsclient,productclient,orderclient