簡體   English   中英

Spring Boot Actuator - 啟用單個端點

[英]Spring Boot Actuator - enable single endpoint

HealthMvcEndpoint 中兩個版本的 Spring Boot Actuator(1.2.5 和 1.3.0)的實現存在差異,isUnrestricted() 方法( && 和 || )。 我了解這是為了保留這些限制

http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready-health-access-restrictions

但是現在是否有任何解決方案可以僅啟用一個端點(例如 Health)不受全部內容限制,而不會暴露所有其他端點? 禁用 management.security.enabled 只是使所有端點無需身份驗證(?)即可訪問 - 它看起來不像是對端點敏感。

我設法通過首先通過endpoints.enabled = false禁用所有端點並禁用它們的安全management.security.enabled = false來部分解決這個問題
並在沒有安全性的情況下啟用我想要的那些 - 比如 Health 端點endpoints.health.enabled = trueendpoints.health.sensitive = false

使用執行器 2,這些屬性已更改

禁用所有執行器端點,請使用

management.endpoints.enabled-by-default=false

要啟用特定端點,請使用management.endpoint.<id>.enabled屬性。 以下示例啟用關閉端點:

management.endpoint.shutdown.enabled=true

官方文檔

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM