主要用来确认系统状态和各种meta数据的插件包
本文只针对Spring Boot 2.0以上版本,2.0以下版本请自行百度。
详细文档
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html
导入
compile('org.springframework.boot:spring-boot-starter-actuator')
只是运用默认设置的话,简单导入后就可以直接使用了。
端点运用
监视端点的端口默认是和应用端口一样,如果希望改变,可以设置
management.server.port
属性设置-application.properties
Spring Boot Actuator的各端口需要设置 有效-enable,开放-exposure
通过设置有效/无效—设置指定端口的使用
通过设置开放/关闭—设置指定端口可否通过http访问
除了shutdown,其他端口默认有效
除了health,info,其他端口默认关闭
例
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
management.endpoint.info.enabled=false
endpoint
提供了各种用来确认系统状态的各种端点,
以下例:(8080端口是当前应用的设置端口,自行设置。)
//auto-configuration设定确认
http://localhost:8080/actuator/autoconfig
//container内登录的bean一览
http://localhost:8080/actuator/beans
//thread dump情报
http://localhost:8080/actuator/dump
//环境设置信息
http://localhost:8080/actuator/env
//healthcheck 缺省"ok"返回,可自行指定
http://localhost:8080/actuator/health
//@RequestMapping情报
http://localhost:8080/actuator/mappings
//shutdown,缺省无效,可在配置文件中设置有效
http://localhost:8080/actuator/shutdown
等其他。