gpt4 book ai didi

Spring Boot Actuator 改变/health的格式

转载 作者:行者123 更新时间:2023-12-05 01:13:48 25 4
gpt4 key购买 nike

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

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

代替:

{
"status": "UP"
}

我不知道这是什么原因。任何想法?或者如何将输出 json 重新格式化为原始格式?不覆盖 HealthIndicator,仅重新格式化。

提前致谢。

最佳答案

Spring 执行器 2.2 Health Endpoint JSON文档说:

The /actuator/health endpoint has changed the resulting JSON format by renaming details to components for the first-level elements. This helps to differentiate the actual details returned by a HealthIndicator from the component indicators that make up composite health.

As a result of the change, the actuator media type has been bumped from application/vnd.spring-boot.actuator.v2+json to application/vnd.spring-boot.actuator.v3+json. If you have tools that need to consume the older format, you can use an HTTP Accept: header with the V2 media type, application/vnd.spring-boot.actuator.v2+json.

此外,如果您想查看与health 相关的所有文档以及什么是groups?如何自定义 health indicator 看看 Current Health Information

关于Spring Boot Actuator 改变/health的格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59683741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com