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

posted @ 2019-01-11 15:32  人在江湖之诗和远方  阅读(2184)  评论(0编辑  收藏  举报