首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的Spring应用程序的/health端点正在释放关于在同一台机器上运行的领事服务器的所有信息。怎么才能让这个失效?

我的Spring应用程序的/health端点正在释放关于在同一台机器上运行的领事服务器的所有信息。怎么才能让这个失效?
EN

Stack Overflow用户
提问于 2017-01-12 12:35:35
回答 3查看 10K关注 0票数 4

我已经启用了/health端点,但我只是不希望它列出领事在同一台机器上监视的所有服务。

这是我的application.properties:

代码语言:javascript
复制
# 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

..。这就是/health目前正在发布的内容:

代码语言:javascript
复制
$ 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"
}

我不介意"description": "Spring Cloud Consul Discovery Client",但是"consul""discoveryComposite"下的其他东西是我不想为/health公开的东西。

什么能把这些信息添加到这个端点呢?

EN

回答 3

Stack Overflow用户

发布于 2017-01-12 19:15:08

它来自。

若要禁用discoveryComposite设置属性spring.cloud.discovery.client.composite-indicator.enabled=false,请执行以下操作。

management.health.consul.enabled=false设置为另一个。

票数 12
EN

Stack Overflow用户

发布于 2021-09-20 10:39:42

禁用SpringBoot 2.3.x中的复合输出

  • 只需使用以下键:
代码语言:javascript
复制
spring:
  cloud:
    discovery:
      client:
        composite-indicator:
          enabled: false
  • 之后,发现的输出没有打印在健康检查的状态中。
票数 3
EN

Stack Overflow用户

发布于 2022-10-24 15:23:41

在我的例子中,设置spring.cloud.discovery.client.health-indicator.enabled: falsespring.cloud.discovery.client.composite-indicator.enabled: false都有效。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41613397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档