第一步:在Spring boot应用中添加actuator 的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
第二步:application.properties中添加配置
#这里用*代表暴露所有端点只是为了观察效果,实际中按照需进行端点暴露
management.endpoints.web.exposure.include=*
#详细信息显示给所有用户。
management.endpoint.health.show-details=always
第三步:启动应用,访问actuator
http://127.0.0.1:8888/study/actuator/beans
或者
http://127.0.0.1:8888/study/actuator/mappings
其他监控信息查询
/actuator/autoconfig
应用的自动化配置报告/actuator/beans
应用上下文创建的所有 Bean/actuator/configprops
应用中配置的属性信息报告/actuator/env
环境属性报告/actuator/mappings
SpringMVC 的控制器映射关系报告/actuator/info
自定义的配置信息/actuator/metrics
当前应用的各类重要度量指标/actuator/health
应用的各类健康指标信息/actuator/threaddump
用来暴露程序运行中的线程信息/actuator/httptrace
显示HTTP跟踪信息(默认显示最后100个HTTP请求)/actuator/scheduledtasks
计划任务