SpringBoot2.0整合Actuator十分簡單,首先爲項目添加依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
直接在瀏覽器中輸入http://localhost:8080/actuator/health,可以展示當前應用狀態
如果要實現更多的細節,可以在application.properties中添加
#health 端點是否必須顯示全部細節
management.endpoint.health.show-details=always
再次輸入http://localhost:8080/actuator/health效果如下
配置application.properties,使用info.*屬性顯示應用信息
info.app,[email protected]@
[email protected]@
[email protected]@
[email protected]@
訪問http://localhost:8080/actuator/info