From ab249b034d696162616414e7833c58ce728d9179 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 5 Nov 2013 00:04:06 -0800 Subject: [PATCH] Rename Outcome -> ConditionOutcome --- .../ErrorMvcAutoConfiguration.java | 8 ++--- .../{Outcome.java => ConditionOutcome.java} | 36 ++++++++++++++----- .../condition/OnBeanCondition.java | 8 ++--- .../condition/OnClassCondition.java | 8 ++--- .../condition/OnExpressionCondition.java | 4 +-- .../condition/OnResourceCondition.java | 6 ++-- .../condition/OnWebApplicationCondition.java | 20 +++++------ .../condition/SpringBootCondition.java | 6 ++-- .../jdbc/DataSourceAutoConfiguration.java | 34 +++++++++--------- .../report/AutoConfigurationDecision.java | 8 ++--- .../report/AutoConfigurationReport.java | 6 ++-- .../DispatcherServletAutoConfiguration.java | 10 +++--- 12 files changed, 87 insertions(+), 67 deletions(-) rename spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/{Outcome.java => ConditionOutcome.java} (53%) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java index d8068a2320..679936bae9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ErrorMvcAutoConfiguration.java @@ -32,7 +32,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.Outcome; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration.DefaultTemplateResolverConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; @@ -97,17 +97,17 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom private static class ErrorTemplateMissingCondition extends SpringBootCondition { @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (ClassUtils.isPresent("org.thymeleaf.spring3.SpringTemplateEngine", context.getClassLoader())) { if (DefaultTemplateResolverConfiguration.templateExists( context.getEnvironment(), context.getResourceLoader(), "error")) { - return Outcome.noMatch("Thymeleaf template found for error view"); + return ConditionOutcome.noMatch("Thymeleaf template found for error view"); } } // FIXME: add matcher for JSP view if Jasper detected - return Outcome.match("no error template view detected"); + return ConditionOutcome.match("no error template view detected"); }; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/Outcome.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java similarity index 53% rename from spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/Outcome.java rename to spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java index 073b6add94..d9329c6e57 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/Outcome.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java @@ -17,34 +17,54 @@ package org.springframework.boot.autoconfigure.condition; /** - * Outcome for a match, including log message. + * Outcome for a condition match, including log message. + * + * @author Phillip Webb */ -public class Outcome { +public class ConditionOutcome { private final boolean match; + private final String message; - public Outcome(boolean match, String message) { + public ConditionOutcome(boolean match, String message) { this.match = match; this.message = message; } - public static Outcome match() { + /** + * Create a new {@link ConditionOutcome} instance for a 'match'. + */ + public static ConditionOutcome match() { return match(null); } - public static Outcome match(String message) { - return new Outcome(true, message); + /** + * Create a new {@link ConditionOutcome} instance for 'match'. + * @param message the message + */ + public static ConditionOutcome match(String message) { + return new ConditionOutcome(true, message); } - public static Outcome noMatch(String message) { - return new Outcome(false, message); + /** + * Create a new {@link ConditionOutcome} instance for 'no match'. + * @param message the message + */ + public static ConditionOutcome noMatch(String message) { + return new ConditionOutcome(false, message); } + /** + * Return {@code true} if the outcome was a match. + */ public boolean isMatch() { return this.match; } + /** + * Return an outcome message or {@code null}. + */ public String getMessage() { return this.message; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index 8bfc89639f..8644b5f852 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java @@ -56,7 +56,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit } @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (metadata.isAnnotated(ConditionalOnBean.class.getName())) { @@ -64,7 +64,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit ConditionalOnBean.class); List matching = getMatchingBeans(context, spec); if (matching.isEmpty()) { - return Outcome.noMatch("@ConditionalOnBean " + spec + " found no beans"); + return ConditionOutcome.noMatch("@ConditionalOnBean " + spec + " found no beans"); } } @@ -73,12 +73,12 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit ConditionalOnMissingBean.class); List matching = getMatchingBeans(context, spec); if (!matching.isEmpty()) { - return Outcome.noMatch("@ConditionalOnMissingBean " + spec + return ConditionOutcome.noMatch("@ConditionalOnMissingBean " + spec + " found the following " + matching); } } - return Outcome.match(); + return ConditionOutcome.match(); } private List getMatchingBeans(ConditionContext context, BeanSearchSpec beans) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java index 800ad96ef5..b0ee49190e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java @@ -37,7 +37,7 @@ import org.springframework.util.StringUtils; class OnClassCondition extends SpringBootCondition { @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { MultiValueMap onClasses = getAttributes(metadata, @@ -46,7 +46,7 @@ class OnClassCondition extends SpringBootCondition { List missing = getMatchingClasses(onClasses, MatchType.MISSING, context); if (!missing.isEmpty()) { - return Outcome.noMatch("required @ConditionalOnClass classes not found: " + return ConditionOutcome.noMatch("required @ConditionalOnClass classes not found: " + StringUtils.collectionToCommaDelimitedString(missing)); } } @@ -57,12 +57,12 @@ class OnClassCondition extends SpringBootCondition { List present = getMatchingClasses(onMissingClasses, MatchType.PRESENT, context); if (!present.isEmpty()) { - return Outcome.noMatch("required @ConditionalOnMissing classes found: " + return ConditionOutcome.noMatch("required @ConditionalOnMissing classes found: " + StringUtils.collectionToCommaDelimitedString(present)); } } - return Outcome.match(); + return ConditionOutcome.match(); } private MultiValueMap getAttributes(AnnotatedTypeMetadata metadata, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java index b24cc412e8..34f100677a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnExpressionCondition.java @@ -33,7 +33,7 @@ import org.springframework.core.type.ClassMetadata; public class OnExpressionCondition extends SpringBootCondition { @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { String expression = (String) metadata.getAnnotationAttributes( @@ -59,7 +59,7 @@ public class OnExpressionCondition extends SpringBootCondition { message.append(" on " + ((ClassMetadata) metadata).getClassName()); } message.append(": " + expression); - return new Outcome(result, message.toString()); + return new ConditionOutcome(result, message.toString()); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java index 47777f5919..149e1049a9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java @@ -38,7 +38,7 @@ class OnResourceCondition extends SpringBootCondition { private ResourceLoader defaultResourceLoader = new DefaultResourceLoader(); @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { MultiValueMap attributes = metadata.getAllAnnotationAttributes( ConditionalOnResource.class.getName(), true); @@ -51,11 +51,11 @@ class OnResourceCondition extends SpringBootCondition { "@ConditionalOnResource annotations must specify at least one resource location"); for (String location : locations) { if (!loader.getResource(location).exists()) { - return Outcome.noMatch("resource not found: " + location); + return ConditionOutcome.noMatch("resource not found: " + location); } } } - return Outcome.match(); + return ConditionOutcome.match(); } private void collectValues(List names, List values) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java index 7ea1072294..a797a7915a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnWebApplicationCondition.java @@ -37,41 +37,41 @@ class OnWebApplicationCondition extends SpringBootCondition { private static final String WEB_CONTEXT_CLASS = "org.springframework.web.context.support.GenericWebApplicationContext"; @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { boolean webApplicationRequired = metadata .isAnnotated(ConditionalOnWebApplication.class.getName()); - Outcome webApplication = isWebApplication(context, metadata); + ConditionOutcome webApplication = isWebApplication(context, metadata); if (webApplicationRequired && !webApplication.isMatch()) { - return Outcome.noMatch(webApplication.getMessage()); + return ConditionOutcome.noMatch(webApplication.getMessage()); } if (!webApplicationRequired && webApplication.isMatch()) { - return Outcome.noMatch(webApplication.getMessage()); + return ConditionOutcome.noMatch(webApplication.getMessage()); } - return Outcome.match(webApplication.getMessage()); + return ConditionOutcome.match(webApplication.getMessage()); } - private Outcome isWebApplication(ConditionContext context, + private ConditionOutcome isWebApplication(ConditionContext context, AnnotatedTypeMetadata metadata) { if (!ClassUtils.isPresent(WEB_CONTEXT_CLASS, context.getClassLoader())) { - return Outcome.noMatch("web application classes not found"); + return ConditionOutcome.noMatch("web application classes not found"); } if (context.getBeanFactory() != null) { String[] scopes = context.getBeanFactory().getRegisteredScopeNames(); if (ObjectUtils.containsElement(scopes, "session")) { - return Outcome.match("found web application 'session' scope"); + return ConditionOutcome.match("found web application 'session' scope"); } } if (context.getEnvironment() instanceof StandardServletEnvironment) { - return Outcome.match("found web application StandardServletEnvironment"); + return ConditionOutcome.match("found web application StandardServletEnvironment"); } - return Outcome.noMatch("not a web application"); + return ConditionOutcome.noMatch("not a web application"); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java index f56993d2ab..01a1266b46 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java @@ -40,7 +40,7 @@ public abstract class SpringBootCondition implements Condition { @Override public final boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - Outcome result = getMatchOutcome(context, metadata); + ConditionOutcome result = getMatchOutcome(context, metadata); StringBuilder message = getMessage(metadata, result); if (!result.isMatch()) { @@ -60,7 +60,7 @@ public abstract class SpringBootCondition implements Condition { return true; } - private StringBuilder getMessage(AnnotatedTypeMetadata metadata, Outcome result) { + private StringBuilder getMessage(AnnotatedTypeMetadata metadata, ConditionOutcome result) { StringBuilder message = new StringBuilder(); message.append("Condition "); message.append(ClassUtils.getShortName(getClass())); @@ -91,7 +91,7 @@ public abstract class SpringBootCondition implements Condition { /** * Determine the outcome of the match along with suitable log output. */ - public abstract Outcome getMatchOutcome(ConditionContext context, + public abstract ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata); protected final boolean anyMatches(ConditionContext context, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index ec08c330be..e89c8a3b23 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.Outcome; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.ApplicationContext; @@ -182,30 +182,30 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { protected abstract String getDataSourceClassName(); @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (!ClassUtils.isPresent(getDataSourceClassName(), context.getClassLoader())) { - return Outcome.noMatch(getDataSourceClassName() + return ConditionOutcome.noMatch(getDataSourceClassName() + " DataSource class not found"); } String driverClassName = getDriverClassName(context.getEnvironment(), getDataSourceClassLoader(context)); if (driverClassName == null) { - return Outcome.noMatch("no database driver"); + return ConditionOutcome.noMatch("no database driver"); } String url = getUrl(context.getEnvironment(), context.getClassLoader()); if (url == null) { - return Outcome.noMatch("no database URL"); + return ConditionOutcome.noMatch("no database URL"); } if (ClassUtils.isPresent(driverClassName, context.getClassLoader())) { - return Outcome.match("found database driver " + driverClassName); + return ConditionOutcome.match("found database driver " + driverClassName); } - return Outcome.noMatch("missing database driver " + driverClassName); + return ConditionOutcome.noMatch("missing database driver " + driverClassName); } /** @@ -253,10 +253,10 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { } @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (matches(context, metadata, this.tomcatCondition)) { - return Outcome.noMatch("tomcat DataSource"); + return ConditionOutcome.noMatch("tomcat DataSource"); } return super.getMatchOutcome(context, metadata); } @@ -278,17 +278,17 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { private SpringBootCondition dbcpCondition = new BasicDatabaseCondition(); @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (anyMatches(context, metadata, this.tomcatCondition, this.dbcpCondition)) { - return Outcome.noMatch("existing non-embedded database detected"); + return ConditionOutcome.noMatch("existing non-embedded database detected"); } EmbeddedDatabaseType type = EmbeddedDatabaseConnection.get( context.getClassLoader()).getType(); if (type == null) { - return Outcome.noMatch("no embedded database detected"); + return ConditionOutcome.noMatch("no embedded database detected"); } - return Outcome.match("embedded database " + type + " detected"); + return ConditionOutcome.match("embedded database " + type + " detected"); } } @@ -301,20 +301,20 @@ public class DataSourceAutoConfiguration implements EnvironmentAware { private SpringBootCondition embeddedCondition = new EmbeddedDatabaseCondition(); @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { if (anyMatches(context, metadata, this.tomcatCondition, this.dbcpCondition, this.embeddedCondition)) { - return Outcome.match("existing auto database detected"); + return ConditionOutcome.match("existing auto database detected"); } if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors( context.getBeanFactory(), DataSource.class, true, false).length > 0) { - return Outcome.match("Existing bean configured database detected"); + return ConditionOutcome.match("Existing bean configured database detected"); } - return Outcome.noMatch("no existing bean configured database"); + return ConditionOutcome.noMatch("no existing bean configured database"); } } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationDecision.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationDecision.java index 25c0da463c..722ab641c4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationDecision.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationDecision.java @@ -16,7 +16,7 @@ package org.springframework.boot.autoconfigure.report; -import org.springframework.boot.autoconfigure.condition.Outcome; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; /** * Collects details about decision made during autoconfiguration (pass or fail) @@ -27,10 +27,10 @@ public class AutoConfigurationDecision { private final String message; private final String classOrMethodName; - private final Outcome outcome; + private final ConditionOutcome outcome; public AutoConfigurationDecision(String message, String classOrMethodName, - Outcome outcome) { + ConditionOutcome outcome) { this.message = message; this.classOrMethodName = classOrMethodName; this.outcome = outcome; @@ -44,7 +44,7 @@ public class AutoConfigurationDecision { return this.classOrMethodName; } - public Outcome getOutcome() { + public ConditionOutcome getOutcome() { return this.outcome; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationReport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationReport.java index 7a7ca18bb7..5003fcfbf6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationReport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/report/AutoConfigurationReport.java @@ -29,7 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.boot.autoconfigure.condition.Outcome; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationListener; @@ -66,7 +66,7 @@ public class AutoConfigurationReport implements ApplicationContextAware, private boolean initialized = false; public static void registerDecision(ConditionContext context, String message, - String classOrMethodName, Outcome outcome) { + String classOrMethodName, ConditionOutcome outcome) { if (context.getBeanFactory().containsBeanDefinition(AUTO_CONFIGURATION_REPORT) || context.getBeanFactory().containsSingleton(AUTO_CONFIGURATION_REPORT)) { AutoConfigurationReport autoconfigurationReport = context.getBeanFactory() @@ -89,7 +89,7 @@ public class AutoConfigurationReport implements ApplicationContextAware, } private void registerDecision(String message, String classOrMethodName, - Outcome outcome) { + ConditionOutcome outcome) { AutoConfigurationDecision decision = new AutoConfigurationDecision(message, classOrMethodName, outcome); if (!this.autoconfigurationDecisions.containsKey(classOrMethodName)) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java index d172095d23..a0defd6701 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java @@ -24,7 +24,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.Outcome; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.context.annotation.Bean; @@ -65,20 +65,20 @@ public class DispatcherServletAutoConfiguration { private static class DefaultDispatcherServletCondition extends SpringBootCondition { @Override - public Outcome getMatchOutcome(ConditionContext context, + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); String[] beans = beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false); if (beans.length == 0) { - return Outcome.match("no DispatcherServlet found"); + return ConditionOutcome.match("no DispatcherServlet found"); } if (Arrays.asList(beans).contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) { - return Outcome.noMatch("found DispatcherServlet named " + return ConditionOutcome.noMatch("found DispatcherServlet named " + DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); } - return Outcome + return ConditionOutcome .match("one or more DispatcherServlets found and none is named " + DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); }