Spring boot 我的Spring Boot应用程序的/health端点正在发送有关在同一台计算机上运行的领事服务器的所有信息。如何禁用此功能?
我启用了/health端点,但我只是不希望它列出同一台计算机上由concur监控的所有服务 这是我的应用程序。属性:Spring boot 我的Spring Boot应用程序的/health端点正在发送有关在同一台计算机上运行的领事服务器的所有信息。如何禁用此功能?,spring-boot,spring-cloud,spring-boot-actuator,spring-cloud-consul,Spring Boot,Spring Cloud,Spring Boot Actuator,Spring Cloud Consul,我启用了/health端点,但我只是不希望它列出同一台计算机上由concur监控的所有服务 这是我的应用程序。属性: # Enable just the health endpoint. endpoints.health.enabled=true # Disable all default endpoints and Spring Cloud endpoints. endpoints.enabled=false endpoints.consul.enabled=false endpoints.
# Enable just the health endpoint.
endpoints.health.enabled=true
# Disable all default endpoints and Spring Cloud endpoints.
endpoints.enabled=false
endpoints.consul.enabled=false
endpoints.pause.enabled=false
endpoints.resume.enabled=false
endpoints.refresh.enabled=false
endpoints.restart.enabled=false
endpoints.shutdown.enabled=false
endpoints.env.enabled=false
management.health.db.enabled=false
management.health.diskspace.enabled=false
management.health.defaults.enabled=false
。。。这就是当前/健康所散发的信息:
$ curl -o- http://localhost:8080/health | python -m json.tool
{
"consul": {
"advertiseAddress": "10.10.10.10",
"bindAddress": "10.10.10.10",
"clientAddress": "127.0.0.1",
"datacenter": "DC",
"domain": "consul.",
"nodeName": "mynode",
"services": {
"myservice1": [
"tag1"
],
"myservice2": [
"tag1",
"tag2"
]
},
"status": "UP"
},
"description": "Spring Cloud Consul Discovery Client",
"discoveryComposite": {
"description": "Spring Cloud Consul Discovery Client",
"discoveryClient": {
"description": "Spring Cloud Consul Discovery Client",
"services": [
"myservice1",
"myservice2"
],
"status": "UP"
},
"status": "UP"
},
"status": "UP"
}
我不介意“描述”:“Spring Cloud Consour Discovery Client”
,但是“Consour”
和“discoveryComposite”
下的其他内容是我不想为/health
公开的
是什么将这些信息添加到此端点的?它来自Spring Cloud Commons 要禁用
discoveryComposite
请设置属性spring.cloud.discovery.client.composite indicator.enabled=false
为另一个设置
management.health.consur.enabled=false
。为其他可能看到相同问题的人回答我自己的问题:management.security.enabled=false
是在应用程序启动期间在一个Spring配置文件中设置的,我没有注意到。根据这里的文档:我需要设置endpoints.health.sensitive=true
来报告状态。添加此令牌修复了问题。谢谢@Spencergib,spring.cloud.discovery.client.composite indicator.enabled=false
关闭了discoveryComposite
,但令人惊讶的是management.health.consur.enabled=false
并没有关闭“consul”:{}/health
中的
部分。它可能在spring cloud Consult的稍后版本中。您使用的是什么版本?在应用程序启动期间,在一个Spring配置文件中设置了一个更新:management.security.enabled=false
,我没有注意到。根据这里的文档:我需要设置endpoints.health.sensitive=true
来报告状态。添加此令牌修复了此问题。>但令人惊讶的是,management.health.consor.enabled=false
没有关闭/health
中的“{}”部分。通过在bootstrap.xml