Merge branch '2.0.x'

pull/13926/merge
Stephane Nicoll 6 years ago
commit a96856c99a

@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -62,8 +62,6 @@ class OnWebApplicationCondition extends SpringBootCondition {
private ConditionOutcome isWebApplication(ConditionContext context,
AnnotatedTypeMetadata metadata, boolean required) {
ConditionMessage.Builder message = ConditionMessage.forCondition(
ConditionalOnWebApplication.class, required ? "(required)" : "");
Type type = deduceType(metadata);
if (Type.SERVLET == type) {
return isServletWebApplication(context);
@ -72,6 +70,14 @@ class OnWebApplicationCondition extends SpringBootCondition {
return isReactiveWebApplication(context);
}
else {
return isAnyWebApplication(context, required);
}
}
private ConditionOutcome isAnyWebApplication(ConditionContext context,
boolean required) {
ConditionMessage.Builder message = ConditionMessage.forCondition(
ConditionalOnWebApplication.class, required ? "(required)" : "");
ConditionOutcome servletOutcome = isServletWebApplication(context);
if (servletOutcome.isMatch() && required) {
return new ConditionOutcome(servletOutcome.isMatch(),
@ -89,7 +95,6 @@ class OnWebApplicationCondition extends SpringBootCondition {
message.because(servletOutcome.getMessage()).append("and")
.append(reactiveOutcome.getMessage()));
}
}
private ConditionOutcome isServletWebApplication(ConditionContext context) {
ConditionMessage.Builder message = ConditionMessage.forCondition("");

Loading…
Cancel
Save