springboot-actuator(使用篇)

springboot-actuator基础使用(一)

springboot监控使用配置介绍,以下示例基于springboot使用2.1.13.RELEASE版本。

1. springboot项目maven引入actuator配置

<code>  <dependency>
<groupid>org.springframework.boot/<groupid>
<artifactid>spring-boot-starter-actuator/<artifactid>
/<dependency>/<code>

2. application.properties配置

<code>    #允许开启监控端点
management.endpoints.enabled-by-default=true
#放开http所有监控端点
management.endpoints.web.exposure.include=*
#设置显示健康状态明细(有注册中心需要查看健康状态有用)
management.endpoint.health.show-details=always
/<code>

3. application.yml配置

<code>management:
endpoints:
web:
exposure:
include: *
enabled-by-default: true
endpoint:
health:
show-details: always/<code>

4.启动项目访问url

<code>http://localhost:8080/actuator/<code>

请求地址返回json数据,里面的每个地址都可以访问得到对应的应用信息

本文由博客群发一文多发等运营工具平台 OpenWrite 发布


分享到:


相關文章: