[英]Spring boot application /actuator/refresh return 404
事實:
management: endpoints: web: exposure: include: '*'
如果我做一個curl -X POST localhost:8080/actuator/refresh
得到以下響應:
> "timestamp":"2022-01-20T13:32:48.516+00:00","status":404,"error":"Not
> Found","path":"/actuator/refresh"}
我已經檢查了有關該主題的所有帖子並嘗試了所有可能的解決方案,但直到現在還沒有成功。 我在哪里失敗?
PS: curl localhost:8080/actuator/health
正在返回有效響應。
{“狀態”:“UP”}
編輯:我發現 /actuator/refresh 正在使用以下 spring 引導版本及以下 使用較新的版本直到現在沒有成功
<version>2.3.12.RELEASE</version>
編輯2:
spring 通過 2.4.0 啟動沒有refresh
端點
默認情況下,除了關閉之外的所有端點都已啟用。 要配置端點的啟用,請使用其 management.endpoint..enabled 屬性。 以下示例啟用關閉端點:
端點列表中未提及刷新端點https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.exposing
如果您想擁有新的自定義端點,spring 執行器提供了一種方法:
@Component @Endpoint(id="custom-endpoint") public class CustomEndPoint { @ReadOperation public CustomData customEndpoint() { // you have to define this class CustomData CustomData data = new CustomData(); //... set some attributes return data; } }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.