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

如何让Spring Boot Actuator端点列表包含管理端口?

解决Spring Boot Actuator根端点返回链接缺失管理端口的问题

要让Actuator根端点返回的链接包含自定义管理端口,只需通过配置文件指定Actuator的公共访问地址即可,以下是具体配置方案:

配置文件方式(推荐)

根据你使用的配置文件类型(.properties或.yml)选择对应配置:

使用application.properties

# 指定Actuator的管理端口
management.server.port=123456
# 设置Actuator的基础访问路径(默认就是/actuator,可按需调整)
management.endpoints.web.base-path=/actuator
# 配置Actuator对外暴露的公共地址,包含端口
management.server.public-address=http://localhost:123456
# 允许暴露所有Actuator端点(按需调整,比如只暴露health、info的话可改为health,info)
management.endpoints.web.exposure.include=*

使用application.yml

management:
  server:
    port: 123456
    public-address: http://localhost:123456
  endpoints:
    web:
      base-path: /actuator
      exposure:
        include: "*"

原理说明

management.server.public-address是核心配置项,它会覆盖Actuator生成端点链接时使用的默认地址,强制让根端点返回的所有子端点链接带上指定的管理端口。

配置完成后重启应用,访问http://localhost:123456/actuator,返回的链接就会包含123456端口,Spring Boot Admin就能正常识别这些端点了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 11:33:19