首页 > 解决方案 > spring cloud config propertySources“名称”已更改

问题描述

从迁移时

 <dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-config-server</artifactId>
     <version>1.3.4.RELEASE</version>
 </dependency>

Greenwich.SR2 (aka 2.1.3.RELEASE)

我编写了一个简单的脚本来比较两台服务器返回的配置(在转换之前进行验证)。我的脚本失败了,因为 propertySources“名称”字段发生了变化:

曾经返回:

"name": "git@my-server:MyOrg/central-config.git/some-application.yml#dev"

现在返回:

"name": "git@my-server:MyOrg/central-config.git/some-application.yml (document #3)"

IE#dev现在(document #3)在调试配置时的价值要低得多。

我知道我可以忽略name测试中的 ,但为了可用性起见,我想恢复旧格式。

这是设计使然吗?
反正有没有配置这个回来?

更新:

升级前: 升级前

升级后: 升级后

标签: spring-cloudspring-cloud-config

解决方案


合理化多文档配置文件处理(https://github.com/spring-projects/spring-boot/commit/c0d79b92735b46010fb922a214b4cbb20c07fda5)是改变行为的提交。

虽然看起来比我更聪明的人想要进行这种更改,但这似乎与调试配置值的来源相反。我觉得我错过了一些知识。后缀是否(document #0)真的有一些我不知道的价值?


推荐阅读