在线上工程中,对服务可用性或者是中间件可用性的检测,是十分有必要的,具体实现,可以自己写一个特殊的接口,接口的实现可以自己实现对中间件比如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调用接口:
这是自己按照参考实现的,重要的是自己做个记录
下面给一些基本的参考链接: