001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.actuate.endpoint.annotation;
018
019import java.lang.annotation.Documented;
020import java.lang.annotation.ElementType;
021import java.lang.annotation.Retention;
022import java.lang.annotation.RetentionPolicy;
023import java.lang.annotation.Target;
024
025import org.springframework.boot.actuate.endpoint.EndpointId;
026
027/**
028 * Identifies a type as being an actuator endpoint that provides information about the
029 * running application. Endpoints can be exposed over a variety of technologies including
030 * JMX and HTTP.
031 * <p>
032 * Most {@code @Endpoint} classes will declare one or more
033 * {@link ReadOperation @ReadOperation}, {@link WriteOperation @WriteOperation},
034 * {@link DeleteOperation @DeleteOperation} annotated methods which will be automatically
035 * adapted to the exposing technology (JMX, Spring MVC, Spring WebFlux, Jersey etc.).
036 * <p>
037 * {@code @Endpoint} represents the lowest common denominator for endpoints and
038 * intentionally limits the sorts of operation methods that may be defined in order to
039 * support the broadest possible range of exposure technologies. If you need deeper
040 * support for a specific technology you can either write an endpoint that is
041 * {@link FilteredEndpoint filtered} to a certain technology, or provide
042 * {@link EndpointExtension extension} for the broader endpoint.
043 *
044 * @author Andy Wilkinson
045 * @author Phillip Webb
046 * @since 2.0.0
047 * @see EndpointExtension
048 * @see FilteredEndpoint
049 * @see EndpointDiscoverer
050 */
051@Target(ElementType.TYPE)
052@Retention(RetentionPolicy.RUNTIME)
053@Documented
054public @interface Endpoint {
055
056        /**
057         * The id of the endpoint (must follow {@link EndpointId} rules).
058         * @return the id
059         * @see EndpointId
060         */
061        String id() default "";
062
063        /**
064         * If the endpoint should be enabled or disabled by default.
065         * @return {@code true} if the endpoint is enabled by default
066         */
067        boolean enableByDefault() default true;
068
069}