在线上工程中,对服务可用性或者是中间件可用性的检测,是十分有必要的,具体实现,可以自己写一个特殊的接口,接口的实现可以自己实现对中间件比如redis,hbase,jms等服务可用性的监测,但springboot有一个十分便捷的工具,能提供服务的监测,就是本次的主题:SpringBoot Actuator

简单地使用,就是引入jar,配置一下application.yml就行了

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

然后配置文件引入一下:

management:
  endpoints:
    web:
      exposure:
        include: "*"
  server:
    port: 10111
    servlet:
      context-path: /
    ssl:
      enabled: false
  endpoint:
    health:
      show-details: always

最终通过postman调用接口:

SpringBoot Actuator的使用

这是自己按照参考实现的,重要的是自己做个记录

下面给一些基本的参考链接:

简书的Actuator

各个接口的详细使用说明

相关文章:

  • 2021-09-04
  • 2021-11-09
  • 2021-08-30
  • 2022-01-18
  • 2022-02-08
  • 2021-07-16
  • 2022-12-23
猜你喜欢
  • 2021-07-05
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-10-22
  • 2021-12-15
相关资源
相似解决方案