springboot的actuator配置

本文介绍了如何配置Springboot的Actuator模块,包括引入2.0.0版本依赖,yaml文件设置,如management.endpoint、management.endpoints.web.cors、management.endpoints.jmx等关键配置项,以及management.server的相关属性,如地址、端口和上下文路径。默认暴露的端点为/health和/info。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、引入依赖包(2.0.0版本)

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

2、yaml文件配置

#暴露端口
management:
  endpoints:
    web:
      exposure:
        include: "*"   # * 在yaml 文件属于关键字

3、keys的配置
management.endpoint..*
management.endpoints.web.cors.*
management.endpoints.jmx.*
management.server.address
management.server.servlet.context-path
management.server.ssl.*
management.server.port

4、端口详细
只有端点/health和/info端点是默认暴露的

HTTP方法路径描述
GET/actuator/conditions提供了一份自动配置报告,记录哪些自动配置条件通过了,哪些没通过
GET/actuator/configprops描述配置属性(包含默认值)如何注入Bean
GET/actuator/beans描述应用程序上下文里全部的Bean,以及它们的关系
GET/actuator/dump获取线程活动的快照
GET/actuator/env获取全部环境属性
GET/actuator/env/{name}根据名称获取特定的环境属性值
GET/actuator/health报告应用程序的健康指标,这些值由HealthIndicator的实现类提供
GET/actuator/info获取应用程序的定制信息,这些信息由info打头的属性提供
GET/actuator/mappings描述全部的URI路径,以及它们和控制器(包含Actuator端点)的映射关系
GET/actuator/metrics报告各种应用程序度量信息,比如内存用量和HTTP请求计数
GET/actuator/metrics/{name}报告指定名称的应用程序度量值
POST/actuator/shutdown关闭应用程序,要求endpoints.shutdown.enabled设置为true
GET/actuator/httptrace提供基本的HTTP请求跟踪信息(时间戳、HTTP头等)
POST/actuator/bus-refresh配置更新
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值