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

访问Spring Boot Actuator端点返回404,已配置依赖属性仍不生效如何解决?

你遗漏的必要配置及错误调整如下:
  • 依赖范围配置错误
    你使用了compileOnly声明actuator依赖,该范围仅在编译期生效,运行时不会加载对应类,自然无法提供端点服务。需要修改为:
implementation 'org.springframework.boot:spring-boot-starter-actuator'

修改后重新刷新Gradle依赖。

  • 端点配置属性错误
    Spring Boot 2.x及以上版本actuator端点的配置前缀为management,你写的endpoints.health.enabled=true是1.x版本的旧配置,不会生效。同时默认情况下web端仅暴露health、info两个端点,若有额外暴露需求需要主动配置。在application.properties中补充/修改为:
# 开启health端点(默认已开启,可省略)
management.endpoint.health.enabled=true
# 暴露指定端点,*代表暴露所有端点
management.endpoints.web.exposure.include=health
  • 访问路径错误
    默认actuator的web根路径为/actuator,而非你访问的/application。如果你没有自定义management.endpoints.web.base-path配置,正确的访问地址应为http://localhost:9000/actuator/health。
    如果你确实需要使用/application作为根路径,需要补充配置:
management.endpoints.web.base-path=/application

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.28 02:24:01