Search in sources :

Example 1 with Endpoint

use of org.springframework.boot.actuate.endpoint.annotation.Endpoint in project spring-boot by spring-projects.

the class OnAvailableEndpointCondition method getEndpointAnnotation.

protected MergedAnnotation<Endpoint> getEndpointAnnotation(Class<?> target) {
    MergedAnnotations annotations = MergedAnnotations.from(target, SearchStrategy.TYPE_HIERARCHY);
    MergedAnnotation<Endpoint> endpoint = annotations.get(Endpoint.class);
    if (endpoint.isPresent()) {
        return endpoint;
    }
    MergedAnnotation<EndpointExtension> extension = annotations.get(EndpointExtension.class);
    Assert.state(extension.isPresent(), "No endpoint is specified and the return type of the @Bean method is " + "neither an @Endpoint, nor an @EndpointExtension");
    return getEndpointAnnotation(extension.getClass("endpoint"));
}
Also used : EndpointExtension(org.springframework.boot.actuate.endpoint.annotation.EndpointExtension) ExposableEndpoint(org.springframework.boot.actuate.endpoint.ExposableEndpoint) Endpoint(org.springframework.boot.actuate.endpoint.annotation.Endpoint) MergedAnnotations(org.springframework.core.annotation.MergedAnnotations)

Example 2 with Endpoint

use of org.springframework.boot.actuate.endpoint.annotation.Endpoint in project spring-boot by spring-projects.

the class OnAvailableEndpointCondition method getMatchOutcome.

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    Environment environment = context.getEnvironment();
    MergedAnnotation<ConditionalOnAvailableEndpoint> conditionAnnotation = metadata.getAnnotations().get(ConditionalOnAvailableEndpoint.class);
    Class<?> target = getTarget(context, metadata, conditionAnnotation);
    MergedAnnotation<Endpoint> endpointAnnotation = getEndpointAnnotation(target);
    return getMatchOutcome(environment, conditionAnnotation, endpointAnnotation);
}
Also used : ExposableEndpoint(org.springframework.boot.actuate.endpoint.ExposableEndpoint) Endpoint(org.springframework.boot.actuate.endpoint.annotation.Endpoint) Environment(org.springframework.core.env.Environment)

Aggregations

ExposableEndpoint (org.springframework.boot.actuate.endpoint.ExposableEndpoint)2 Endpoint (org.springframework.boot.actuate.endpoint.annotation.Endpoint)2 EndpointExtension (org.springframework.boot.actuate.endpoint.annotation.EndpointExtension)1 MergedAnnotations (org.springframework.core.annotation.MergedAnnotations)1 Environment (org.springframework.core.env.Environment)1