1.引入jar包:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
2.打开配置开关:
actuator 提供了 jmx http 两种对外接口,以http为例。
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=env,beans
3.打开浏览器,输入 http://localhost:8888/actuator
该接口提供了所有actuator 接口列表:

上面各个接口作用是什么,可以对着官方文档去查找:
4.重点接口讲解
http://localhost:8888/actuator/heapdump 可以dump出当前jvm的heap
http://localhost:8888/actuator/threaddump 当前jvm的线程快照
http://localhost:8888/actuator/httptrace 最近的100个http请求,包括request和response内容。
http://localhost:8888/actuator/mappings 所有的spring-mvc http接口
总结:
1.部分接口如果暴露在公网,很危险,需要配置好网关出口规则。
2.可以用这些接口做一些服务监控,管理工作。