Spring Boot Endpoint


Spring Boot 的 Endpoints 帶着強烈的 DevOps 色彩, “you build it, you run it” ,開發不僅要關心如何實現功能,還需要關心服務在線上運行的狀態,如果缺乏實時監控,維護線上服務必然是一場噩夢。

 

 

/**
 * An endpoint that can be used to expose useful information to operations. Usually
 * exposed via Spring MVC but could also be exposed using some other technique. Consider
 * extending {@link AbstractEndpoint} if you are developing your own endpoint.
 *
 * @param <T> the endpoint data type
 * @author Phillip Webb
 * @author Dave Syer
 * @author Christian Dupuis
 * @see AbstractEndpoint
 */
public interface Endpoint<T> {

    /**
     * The logical ID of the endpoint. Must only contain simple letters, numbers and '_'
     * characters (i.e. a {@literal "\w"} regex).
     * @return the endpoint ID
     */
    String getId();

    /**
     * Return if the endpoint is enabled.
     * @return if the endpoint is enabled
     */
    boolean isEnabled();

    /**
     * Return if the endpoint is sensitive, i.e. may return data that the average user
     * should not see. Mappings can use this as a security hint.
     * @return if the endpoint is sensitive
     */
    boolean isSensitive();

    /**
     * Called to invoke the endpoint.
     * @return the results of the invocation
     */
    T invoke();

}

 

 

 demo

https://412887952-qq-com.iteye.com/blog/2380027

 

 

 


 

Springboot admin 

 

ref

https://docs.spring.io/spring-boot/docs/1.1.x/reference/htmlsingle/#production-ready-endpoints

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM