我正在考虑通过 Spring Cloud Config 实现 12factor 方法来外部化配置,但无法按预期使用 searchPaths 使通配符工作。
文档http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server提到可以在 searchPaths 变量中使用通配符 {application}、{label}、{profile},以便“您可以隔离路径中的目录,并选择对您有意义的策略(例如每个应用程序的子目录,或每个配置文件的子目录)。 ”
我希望有一个 git repo,每个配置文件都有子目录(然后是每个应用程序,或者每个应用程序的子目录(然后是配置文件)。
例如
spring:
cloud:
config:
server:
git:
uri: https://stash.xxx.com.au/scm/xxx/config
searchPaths: {application}
or
searchPaths: {profile}
or
searchPaths: {application}/{profile}
Run Code Online (Sandbox Code Playgroud)
但是,当我在搜索路径中使用任何通配符 {application} 或 {profile} 时,它在 git repo 中找不到数据,或者连接选项根本无法启动。
有没有人有我可以参考的工作示例?干杯罗伊