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

Play+Spring应用集成Prometheus访问/actuator/prometheus返回404求助

排查解决步骤
  • 配置加载验证
    Play框架默认使用application.conf,但Spring Boot原生默认读取application.yml/application.properties配置源,首先确认Spring上下文是否正确读取到了management.endpoints.web.exposure.include="prometheus"配置:可以在Spring托管的Bean中注入@Value("${management.endpoints.web.exposure.include:}")打印值校验。如果未读取到,可将该配置迁移到Spring识别的配置文件中,或配置Play配置源同步到Spring上下文。
  • 依赖版本兼容性校验
    Spring Boot 2.2.4.RELEASE官方适配的Micrometer版本为1.3.x系列,你当前使用的micrometer-registry-prometheus:1.2.0存在版本兼容风险,可能导致端点注册失败。建议移除该依赖的版本号,由Spring Boot依赖管理自动适配对应版本,或手动升级到1.3.x匹配版本。
  • 路由与路径配置校验
    1. 检查是否自定义了Actuator根路径:若配置了management.endpoints.web.base-path,需将访问路径的/actuator替换为自定义的根路径值
    2. 混合架构路由校验:Play+Spring架构下请求默认由Play路由规则优先处理,需确认Play路由配置中是否将/actuator/**路径的请求转发到Spring的DispatcherServlet,若Play未配置对应转发规则,会直接返回404。
  • 端点开启状态校验
    如果存在全局关闭Actuator端点的配置management.endpoints.enabled-by-default=false,需要额外添加配置management.endpoint.prometheus.enabled=true手动开启Prometheus端点。
  • 启动日志校验
    查看服务启动日志,搜索关键词endpoint,正常注册成功会打印类似Exposing 1 endpoint(s) beneath base path '/actuator'的日志,若日志中未包含prometheus端点,可向上检索相关依赖加载、类初始化的异常信息定位问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.30 04:45:05