springboot-actuator应用后台监控
一 前言 springboot 额外的特色是提供了后台应用监控,可以通过 HTTP 或者 JMX的方式管理监控应用,本文主讲HTTP方式;其主要的功能是监控应用的健康状态,查看环境变量等; 二 pom.xml springboot 2.1.1,主要引入 actuator 依赖,web依赖用于测试; <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> 三 默认开启端点 3.1 默认端点 health 直接编写主程序入口,启动;浏览器输入 http://localhost:8080/actuator/health;结果如下,状态是UP; 翻翻源码heath状态码如下 public OrderedHealthAggregator() { this.setStatusOrder(Status.DOWN, Status.OUT_OF_SERVICE,