This commit is contained in:
Stephane Nicoll 2015-08-04 10:55:23 +02:00
parent 91b2c3aee5
commit bf0b857357

View File

@ -31,11 +31,14 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
*/
class OnEnabledEndpointCondition extends SpringBootCondition {
private static final String ANNOTATION_CLASS = ConditionalOnEnabledEndpoint.class
.getName();
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata
.getAnnotationAttributes(ConditionalOnEnabledEndpoint.class.getName()));
.getAnnotationAttributes(ANNOTATION_CLASS));
String endpointName = annotationAttributes.getString("value");
boolean enabledByDefault = annotationAttributes.getBoolean("enabledByDefault");
ConditionOutcome outcome = determineEndpointOutcome(endpointName,
@ -53,7 +56,7 @@ class OnEnabledEndpointCondition extends SpringBootCondition {
if (resolver.containsProperty("enabled") || !enabledByDefault) {
boolean match = resolver.getProperty("enabled", Boolean.class,
enabledByDefault);
return new ConditionOutcome(match, "The " + endpointName + " is "
return new ConditionOutcome(match, "The endpoint " + endpointName + " is "
+ (match ? "enabled" : "disabled"));
}
return null;