Spring Boot执行器更改/ health的格式

问题描述 投票:0回答:1

最近我将spring-boot-starter-actuator更新为2.2.2,当我使用/health端点时,我得到了:

{
    "groups": [],
    "status": {
        "code": "UP",
        "description": ""
    }
}

而不是:

{
    "status": "UP"
}

而且我对此一无所知。任何想法?或者如何将输出json重新格式化为原始格式?不覆盖HealthIndicator,仅重新格式化。

提前感谢。

spring spring-boot spring-boot-actuator
1个回答
0
投票

Health Endpoint JSON文档说:

/actuator/health端点已通过以下方式更改了结果JSON格式:将第一级元素的details重命名为components。这个有助于区分由客户返回的实际详细信息HealthIndicator由组成复合的成分指标健康。

作为更改的结果,执行器介质类型被碰撞从application/vnd.spring-boot.actuator.v2+jsonapplication/vnd.spring-boot.actuator.v3+json。如果您有工具需要使用旧格式时,可以使用HTTP Accept:标头V2媒体类型为application/vnd.spring-boot.actuator.v2+json

© www.soinside.com 2019 - 2024. All rights reserved.