use of org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointExposure in project spring-boot by spring-projects.
the class OnAvailableEndpointCondition method getMatchOutcome.
private ConditionOutcome getMatchOutcome(Environment environment, MergedAnnotation<ConditionalOnAvailableEndpoint> conditionAnnotation, MergedAnnotation<Endpoint> endpointAnnotation) {
ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnAvailableEndpoint.class);
EndpointId endpointId = EndpointId.of(environment, endpointAnnotation.getString("id"));
ConditionOutcome enablementOutcome = getEnablementOutcome(environment, endpointAnnotation, endpointId, message);
if (!enablementOutcome.isMatch()) {
return enablementOutcome;
}
Set<EndpointExposure> exposuresToCheck = getExposuresToCheck(conditionAnnotation);
Set<ExposureFilter> exposureFilters = getExposureFilters(environment);
for (ExposureFilter exposureFilter : exposureFilters) {
if (exposuresToCheck.contains(exposureFilter.getExposure()) && exposureFilter.isExposed(endpointId)) {
return ConditionOutcome.match(message.because("marked as exposed by a 'management.endpoints." + exposureFilter.getExposure().name().toLowerCase() + ".exposure' property"));
}
}
return ConditionOutcome.noMatch(message.because("no 'management.endpoints' property marked it as exposed"));
}
Aggregations