SpringBoot2.0之整合Actuator簡單實例

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
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章