springboot-actuator基础使用(一)
springboot监控使用配置介绍,以下示例基于springboot使用2.1.13.RELEASE版本。
1. springboot项目maven引入actuator配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2. application.properties配置
#允许开启监控端点
management.endpoints.enabled-by-default=true
#放开http所有监控端点
management.endpoints.web.exposure.include=*
#设置显示健康状态明细(有注册中心需要查看健康状态有用)
management.endpoint.health.show-details=always
3. application.yml配置
management:
endpoints:
web:
exposure:
include: *
enabled-by-default: true
endpoint:
health:
show-details: always
4.启动项目访问url
http://localhost:8080/actuator
请求地址返回json数据,里面的每个地址都可以访问得到对应的应用信息
本文由博客群发一文多发等运营工具平台 OpenWrite 发布