【问题标题】:Spring Boot Hyphenated Profile Names Work InconsistentlySpring Boot 带连字符的配置文件名称工作不一致
【发布时间】:2017-06-04 19:42:36
【问题描述】:

从云配置服务器提供服务的 Spring Boot 配置文件似乎支持特定于应用程序的属性文件 {application}-{profile}.properties 的连字符,但不支持全局属性文件 application-{profile}.properties

例如在名为“testapp”的应用程序中:

如果配置文件名称是“testprofile”,那么将属性放在 application-testprofile.properties 和 testapp-testprofile.properties 中将起作用。使用端点 /testapp-testprofile.properties 验证

但是,如果配置文件名称为“test-profile”,则 testapp-test-profile.properties 中的属性将起作用,但 application-test-profile.properties 将不起作用。使用端点 /testapp-test-profile.properties 验证

我是否遗漏了什么,或者这是 Spring 云配置服务器处理属性文件的方式中的一个(非常小的)错误/不一致?

使用 Spring Boot 1.5.0.RC1

【问题讨论】:

    标签: spring-boot spring-cloud-config


    【解决方案1】:

    这与this issue 相关,该this issue 至今仍在营业。显然连字符在spring cloud config server HTTP服务中有着特殊的含义,没有办法转义。正如其他人所做的那样,我最终没有在我的个人资料中使用连字符,这有点烦人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-05
      • 1970-01-01
      • 2020-05-07
      • 2015-12-19
      • 1970-01-01
      相关资源
      最近更新 更多