【发布时间】:2015-09-13 17:39:01
【问题描述】:
我尝试设置一个 Spring Cloud 配置服务器并从 github 上提供的示例开始。 https://github.com/spring-cloud-samples/configserver
但是我对 application.yml (https://github.com/spring-cloud-samples/configserver/blob/master/src/main/resources/application.yml) 配置文件有点困惑。这是关于配置文件“latice”的覆盖部分
spring:
profiles: lattice
cloud:
config:
server:
overrides:
eureka:
client:
serviceUrl:
defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/
instance:
hostname: $\{CF_INSTANCE_IP:localhost}
nonSecurePort: $\{CF_INSTANCE_PORT:$\{PORT:$\{server.port:8080}}}
eureka:
instance:
hostname: ${CF_INSTANCE_IP:localhost}
nonSecurePort: ${CF_INSTANCE_PORT:${PORT:${server.port:8888}}}
client:
serviceUrl:
defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/
为什么需要覆盖?基本上它与下面的 eureka 设置中定义的相同。 我也没有在文档中找到任何关于覆盖的内容。
非常感谢您的帮助
干杯 弗洛里安
【问题讨论】:
-
好问题,乍一看,关于 overrides 属性的文档中没有出现任何内容。查看源代码,它似乎是一种覆盖客户端设置的方法。每个代码 cmets:
Extra map for a property source to be sent to all clients unconditionally
标签: spring-cloud