use of org.springframework.boot.autoconfigure.condition.ConditionOutcome in project spring-boot by spring-projects.
the class OnEnabledEndpointCondition method determineEndpointOutcome.
private ConditionOutcome determineEndpointOutcome(String endpointName, boolean enabledByDefault, ConditionContext context) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), "endpoints." + endpointName + ".");
if (resolver.containsProperty("enabled") || !enabledByDefault) {
boolean match = resolver.getProperty("enabled", Boolean.class, enabledByDefault);
ConditionMessage message = ConditionMessage.forCondition(ConditionalOnEnabledEndpoint.class, "(" + endpointName + ")").because(match ? "enabled" : "disabled");
return new ConditionOutcome(match, message);
}
return null;
}
use of org.springframework.boot.autoconfigure.condition.ConditionOutcome in project spring-boot by spring-projects.
the class OnEnabledEndpointCondition method determineAllEndpointsOutcome.
private ConditionOutcome determineAllEndpointsOutcome(ConditionContext context) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), "endpoints.");
boolean match = Boolean.valueOf(resolver.getProperty("enabled", "true"));
ConditionMessage message = ConditionMessage.forCondition(ConditionalOnEnabledEndpoint.class).because("All endpoints are " + (match ? "enabled" : "disabled") + " by default");
return new ConditionOutcome(match, message);
}
use of org.springframework.boot.autoconfigure.condition.ConditionOutcome in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzer method collectExcludedAutoConfiguration.
private void collectExcludedAutoConfiguration(NoSuchBeanDefinitionException cause, List<AutoConfigurationResult> results) {
for (String excludedClass : this.report.getExclusions()) {
Source source = new Source(excludedClass);
BeanMethods methods = new BeanMethods(source, cause);
for (MethodMetadata method : methods) {
String message = String.format("auto-configuration '%s' was excluded", ClassUtils.getShortName(excludedClass));
results.add(new AutoConfigurationResult(method, new ConditionOutcome(false, message), false));
}
}
}
use of org.springframework.boot.autoconfigure.condition.ConditionOutcome in project spring-boot by spring-projects.
the class OnEnabledEndpointElementCondition method getDefaultEndpointsOutcome.
protected ConditionOutcome getDefaultEndpointsOutcome(ConditionContext context) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), this.prefix + "defaults.");
boolean match = Boolean.valueOf(resolver.getProperty("enabled", "true"));
return new ConditionOutcome(match, ConditionMessage.forCondition(this.annotationType).because(this.prefix + "defaults.enabled is considered " + match));
}
Aggregations