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文件


<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
</dependencies>

🎁公开端点


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}/** 没有设置可以忽略
  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值