java Spring Boot 2 /actuator/health 返回 HTTP 404

分析健康检测接口无法访问

查看官方文档

  • spring-boot-starter-actuator官方文档

  • Spring Boot 包含许多附加功能,可帮助您在将应用程序投入生产时监控和管理应用程序。您可以选择使用 HTTP 端点或 JMX 来管理和监控您的应用程序。审核、运行状况和指标收集也可以自动应用于您的应用程序。

  • 该spring-boot-actuator模块提供了 Spring Boot 的所有生产就绪功能。启用这些功能的推荐方法是添加对spring-boot-starter-actuator"Starter"的依赖项。

导入pom文件

xml 复制代码
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
</dependencies>

公开端点

yaml 复制代码
management:
  endpoints:
    web:
      exposure:
        include:
          - info
          - health
      jmx:
        exposure:
          exclude: "*"
  endpoint:
    info:
      enabled: true
    health:
      enabled: true

无法访问分析

  • 检查是否按照上面的步骤做了
  • 检查访问路径是否正确
    • 按照以下访问路径http://localhost:{server.port}/{server.servlet.context-path}/{management.endpoints.web.base-path}/** 没有设置可以忽略
相关推荐
小羊没烦恼!12 小时前
分布式事务 | 使用DTM 的Saga 模式
java·linux·运维·数据库·wpf
JPower_mr.g12 小时前
SmartCall v1.0.9 发布:智能体知识库上线,让 AI 客服先查资料再回答
java·ide·人工智能·macos·架构·开源·xcode
SL_staff12 小时前
破除执行黑箱:用目标地图、资源热力图与健康度看板构建可下钻的执行事实链
java·开源·全栈
骑着蜗牛撵大象32712 小时前
让 Codex 值夜班:把告警排查与巡检接成可回滚的自动化链路
android·java·运维·ai·自动化·codex·智能体
木头科技12 小时前
【AI 工程化第十八篇】Spring AI 语音 Agent 实战:实时转写、WebSocket、流式 TTS 与打断机制
java·人工智能·安全·spring·性能优化
cfm_291412 小时前
SpringPrototype作用域
java
大风起兮云飞扬丶13 小时前
Java——枚举
java·开发语言
ReStock活库13 小时前
Zephyr异步SPI调用返回后,为什么不能立即复用发送缓冲区?
java·前端·网络
微微%13 小时前
从零搭建一个java开发环境
java·idea2023·jdk17
博风13 小时前
Springboot4.0.9,添加Filter(拦截器)
spring boot