SpringBoot-Actuator

1. 简介

spring-boot-actuator可以监控和管理基于Spring Boot的应用程序
https://docs.spring.io/spring-boot/docs/2.7.18/reference/html/actuator.html

2. demo

在springboot项目中添加依赖

1
2
3
4
<dependency>  
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

浏览器访问:
http://127.0.0.1:8080/actuator

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"_links": {
"self": {
"href": "http://127.0.0.1:8080/actuator",
"templated": false
},
"health": {
"href": "http://127.0.0.1:8080/actuator/health",
"templated": false
},
"health-path": {
"href": "http://127.0.0.1:8080/actuator/health/{*path}",
"templated": true
}
}
}

management.endpoints.web.exposure.include=*查看全部

3. 端点

ID 描述
auditevents 公开当前应用程序的审计事件信息。需要一个AuditEventRepositorybean。
beans 显示应用程序中所有 Spring bean 的完整列表。