我加了compileOnly 'org.springframework.boot:spring-boot-starter-actuator'我build.gradle,在搖籃工具視窗,然后我點擊右邊的專案和選擇Refresh Gradle Dependencies。然后我添加endpoints.health.enabled=true到我的application.properties.
當我啟動我的應用程式并在 URL 上執行 GET 時,http://localhost:9000/application/health我得到以下資訊:
{
"timestamp": "2021-11-05T11:40:13.663 00:00",
"path": "/application/",
"status": 404,
"error": "Not Found",
"message": null,
"requestId": "c8352103-2"
}
啟用執行器時我錯過了什么嗎?
uj5u.com熱心網友回復:
假設您使用的是 Spring Boot 2.x,默認情況下,所有 Actuator 端點都放在 /actuator 路徑下,因此請嘗試http://localhost:9000/actuator/health。如果application確實是您的背景關系路徑的一部分,請嘗試http://localhost:9000/application/actuator/health.
另外,compileOnly 'org.springframework.boot:spring-boot-starter-actuator'應該是implementation 'org.springframework.boot:spring-boot-starter-actuator'。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/350025.html
