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

Spring Boot Actuator无法启动,访问/actuator显示白标页面求助

解决Spring Boot Actuator访问白标错误的方案

1. 修正Actuator依赖

你当前pom中使用的spring-boot-actuator是独立依赖包,Spring Boot 2.x及后续版本推荐使用spring-boot-starter-actuator starter,它包含了Actuator运行所需的自动配置和依赖集合。替换pom中的Actuator依赖为:

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

2. 配置端点暴露规则

Spring Boot Actuator默认仅对外暴露health和info两个端点,且访问基础路径为/actuator。如果需要访问更多端点(如beans、metrics等),需在配置文件中添加暴露配置:

  • 若使用application.properties:
    # 暴露所有端点(生产环境建议按需指定,如health,info,metrics)
    management.endpoints.web.exposure.include=*
    # 显示健康端点的详细信息
    management.endpoint.health.show-details=always
    
  • 若使用application.yml:
    management:
      endpoints:
        web:
          exposure:
            include: '*'
      endpoint:
        health:
          show-details: always
    

3. 重启应用验证

修改依赖和配置后,重新启动Spring Boot应用,再次访问/actuator路径,此时应能看到所有已暴露的端点列表;访问具体端点(如/actuator/health)可查看对应监控信息。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 14:35:33