【web】springboot應用增加actuator管理端點
阿新 • • 發佈:2018-12-17
在spring boot應用中增加actuator管理端點,可以通過訪問actuator提供的一些預設端點快捷的訪問應用的一些執行和配置狀態。
springboot應用中增加actuator端點很簡單,只需要在maven的pom.xml依賴中增加如下依賴配置就可以了,直接上程式碼:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
如下為Actuator暴露的功能:
HTTP方法 | 路徑 | 描述 | 鑑權 |
---|---|---|---|
GET | /autoconfig | 檢視自動配置的使用情況 | true |
GET | /configprops | 檢視配置屬性,包括預設配置 | true |
GET | /beans | 檢視bean及其關係列表 | true |
GET | /dump | 列印執行緒棧 | true |
GET | /env | 檢視所有環境變數 | true |
GET | /env/{name} | 檢視具體變數值 | true |
GET | /health | 檢視應用健康指標 | false |
GET | /info | 檢視應用資訊 | false |
GET | /mappings | 檢視所有url對映 | true |
GET | /metrics | 檢視應用基本指標 | true |
GET | /metrics/{name} | 檢視具體指標 | true |
POST | /shutdown | 關閉應用 | true |
GET | /trace | 檢視基本追蹤資訊 | true |