我正在考虑通过 Spring Cloud Config 实现 12factor 方法来外部化配置,但无法按照我的预期使用 searchPaths 使通配符正常工作。
文档http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server提到通配符 {application}、{label}、{profile} 可以在 searchPaths 变量中使用,以便“您可以隔离路径中的目录,并选择对您有意义的策略(例如每个应用程序的子目录或每个配置文件的子目录)。"
我希望有一个 git 存储库,每个配置文件有子目录(然后是每个应用程序),或者每个应用程序有子目录(然后是配置文件)。
e.g.
spring:
cloud:
config:
server:
git:
uri: https://stash.xxx.com.au/scm/xxx/config
searchPaths: {application}
or
searchPaths: {profile}
or
searchPaths: {application}/{profile}
但是,当我在 searchPaths 中使用任何通配符 {application} 或 {profile} 时,它在 git 存储库中找不到数据,或者串联选项根本无法启动。
有人有我可以参考的工作示例吗?
干杯
罗伊
使用单引号,效果很好。
searchPaths: '{application}'
如果有人偶然发现这个问题,希望这会有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)