我正在使用 Spring Cloud Consul 来管理我的应用程序的配置(Spring Boot:v2.1.4.RELEASE)在上传到 Consul 的文件“application.yml”中,我有以下 Actuator 配置:
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
这导致显示 /actuator/health 端点的详细信息。
当我在应用程序运行时将 Consul 中的此属性更改为值 'NEVER' 时,会注意到更改并刷新此属性,我可以在两个地方检查:
1) 日志
2019-05-15 16:07:52.355 INFO 11020 --- [TaskScheduler-1] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='consul', propertySources=[ConsulFilesPropertySource {name='configuration/application.yml'}]}
2019-05-15 16:07:52.366 INFO 11020 --- [TaskScheduler-1] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2019-05-15 16:07:52.378 INFO 11020 --- [TaskScheduler-1] o.s.boot.SpringApplication : Started application in 2.284 seconds (JVM running for 128.176)
2019-05-15 16:07:52.468 INFO 11020 --- [TaskScheduler-1] o.s.c.e.event.RefreshEventListener : Refresh keys changed: [management.endpoint.health.show-details]
2) 端点/actuator/configprops
"management.endpoint.health-org.springframework.boot.actuate.autoconfigure.health.HealthEndpointProperties": {
"prefix": "management.endpoint.health",
"properties": {
"showDetails": "NEVER",
"roles": []
}
},
问题是/actuator/health
端点仍在提供健康详细信息,而忽略了在运行时对属性“management.endpoint.health.show-details”所做的更改。
是否应该应用任何其他配置?