【发布时间】:2020-02-06 21:27:27
【问题描述】:
这个问题类似于(但目的不同):Shared Config(at git) between SPring Boot Services 所以我将使用 OP 在那里写的示例。
在我的例子中,我使用带有 Vault 作为后端的 Spring Cloud Config Server,但为了论证,我将它描述为好像它在 git 中一样。所以想象一下我有 4 个服务:A, B, C and D。
我有以下配置:
- A-prod.properties
- A-dev.properties
- B-prod.properties
- B-dev.properties
- C-prod.properties
- C-dev.properties
- D-prod.properties
- D-dev.properties
- application-prod.properties
- application-dev.properties
现在根据docs,我将拥有其中一项服务,假设Service C 从C-(ENV).properties 和application-(ENV).properties 获取他的属性。其他人也一样,即每个人都有自己的文件和application.properties上的所有内容。
我的问题是:
是否有可能拥有例如“半全局”共享属性,例如一个A and C 共享一些配置的文件和另一个B and D 共享一些配置的文件?
一个使用示例是数据库连接凭据,其中两个服务使用一组凭据,而其他服务使用另一组。
我一直在尝试查找有关此的信息并进行了一些测试,但没有任何东西让我有所收获...
【问题讨论】:
标签: spring spring-boot spring-boot-configuration