赞
踩
通过引入spring-boot-starter-actuator,可以使用Spring Boot为我们提供的准生产环境下的应用监控和管理功能。我们可以通过HTTP,JMX,SSH协议来进行操作,自动得到审计、健康及指标信息等。
步骤:
引入spring-boot-starter-actuator
通过http方式访问监控端点
可进行shutdown(POST 提交,此端点默认关闭)
监控和管理端点:
定制端点一般通过endpoints+端点名+属性名来设置。
修改端点id(endpoints.beans.id=mybeans)
开启远程应用关闭功能(endpoints.shutdown.enabled=true)
关闭端点(endpoints.beans.enabled=false)
开启所需端点
endpoints.enabled=false
endpoints.beans.enabled=true
定制端点访问根路径
management.context-path=/manage
关闭http端点
management.port=-1
/**
* 自定义健康状态指示器
* 1、编写一个指示器 实现 HealthIndicator 接口
* 2、指示器的名字 xxxxHealthIndicator
* 3、加入容器中
*/
@SpringBootApplication
public class Springboot08ActuatorApplication {
public static void main(String[
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。