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}/** 没有设置可以忽略
相关推荐
PPPHUANG3 小时前
一次 CompletableFuture 误用,如何耗尽 IO 线程池并拖垮整个系统
java·后端·代码规范
恩创软件开发3 小时前
创业日常2026-1-8
java·经验分享·微信小程序·小程序
Yan-英杰3 小时前
BoostKit OmniAdaptor 源码深度解析
网络·人工智能·网络协议·tcp/ip·http
无关86884 小时前
SpringBootApplication注解大解密
spring boot
想用offer打牌4 小时前
一站式了解Spring AI Alibaba的流式输出
java·人工智能·后端
Lonely丶墨轩4 小时前
从登录入口窥见架构:一个企业级双Token认证系统的深度拆解
java·数据库·sql
掘根5 小时前
【仿Muduo库项目】EventLoop模块
java·开发语言
信码由缰5 小时前
Java 中的 AI 与机器学习:TensorFlow、DJL 与企业级 AI
java
沙子迷了蜗牛眼6 小时前
当展示列表使用 URL.createObjectURL 的创建临时图片、视频无法加载问题
java·前端·javascript·vue.js
ganshenml6 小时前
【Android】 开发四角版本全解析:AS、AGP、Gradle 与 JDK 的配套关系
android·java·开发语言