You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何正确暴露/actuator/startup及两个健康探测Actuator端点?

Actuator startup 端点暴露解决方案

核心原因说明

你之前配置不生效主要有两个问题:

  1. management.endpoints.web.exposure.include 是覆盖式配置,单独填写startup会覆盖默认的health端点暴露规则,导致之前的存活、就绪探测端点失效
  2. 缺少startup端点的显式启用配置,部分Spring Boot版本默认不会启用该端点,仅配置暴露规则无法正常访问

完整配置步骤

在application.properties中使用如下配置即可同时满足三个路径的访问需求:

# 启用健康探针,自动暴露liveness、readiness子路径
management.endpoint.health.probes.enabled=true
# 同时暴露健康端点、startup端点
management.endpoints.web.exposure.include=health,startup
# 显式启用startup端点
management.endpoint.startup.enabled=true
# 配置BufferingApplicationStartup,不需要额外代码注入
spring.main.application-startup=buffering
# 可选:调整启动事件缓冲区大小,默认值为1024
spring.application.startup.buffer-size=2048

访问验证

服务重启后,日志会输出Exposing 2 endpoint(s) beneath base path '/actuator'(健康探测的两个路径属于health端点的子路径,不会单独计数),直接使用GET方法请求以下地址即可:

  • 存活探测:/actuator/health/liveness
  • 就绪探测:/actuator/health/readiness
  • 启动事件:/actuator/startup

注:startup端点仅支持GET请求,不需要使用POST方法调用。

内容的提问来源于stack exchange,提问作者Marcin Gemra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 14:06:03