最近在spring boot 2.0.0下配置spring-boot-starter-actuator,加入依赖后启动,发现spring-boot-starter-actuator2.0.0 RELEASE进行了重构,与之前的spring-boot-actuator的使用大有区别

区别1:启动后只显示

/actuator

/actuator/info

/actuator/health

其他的endpoints都没有显示出来

查看文档 https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html

怀疑可能是未enable或未expose造成的

在application.properties中按照文档添加内容

management.endpoints.web.exposure.include=*

于是出现了久违的log

spring boot 2.0.0下spring-boot-starter-actuator默认endpoints未打开

区别2:显示所有健康状态,需要加配置

management.endpoint.health.show-details=always

结果:

spring boot 2.0.0下spring-boot-starter-actuator默认endpoints未打开

从源码可以看到其集成了多个HealthIndicator

spring boot 2.0.0下spring-boot-starter-actuator默认endpoints未打开

spring boot 2.0.0下spring-boot-starter-actuator默认endpoints未打开

相关文章:

  • 2021-10-21
  • 2021-06-10
  • 2021-09-24
  • 2022-02-04
  • 2022-02-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-14
  • 2021-09-21
  • 2021-06-25
  • 2021-11-06
  • 2022-12-23
相关资源
相似解决方案