Spring Boot 中actuator模塊提供了健康檢查,審計、指標收集,HTTP跟蹤等功能,能夠幫助咱們更好的管理和跟蹤springboot項目。web
在須要使用健康監控的項目或module中,添加以下依賴:spring
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
添加完依賴之後,reload項目或module。segmentfault
啓動項目,在瀏覽器中輸入以下地址:(SpringBoot默認打開的監控選項有限)瀏覽器
http://localhost/actuator
其訪問結果,如圖所示:springboot
還能夠在actuator列出的選中中進行點擊,例如訪問health服務器
http://localhost/actuator/health
其呈現結果,如圖所示(其中up狀態表示正常):app
假如但願查看更多actuator選項,能夠在spring boot中配置文件spring-boot
application.properties中添加以下語句:spa
management.endpoints.web.exposure.include=*
而後,重啓服務器,基於訪問http://localhost/actuator地址...)code
本小節主要是對springboot工程中的健康監控功能作了一個簡易分析和實現,本身能夠基於業務的須要,進行監控的配置和分析.