Spring Boot Actuator的使用

主要用来确认系统状态和各种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

等其他。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值