Commit f241cd04 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #23554 from dreis2211

* pr/23554:
  Improve performance of DispatcherServletRegistrationCondition

Closes gh-23554
parents 2ab2cf06 efbbd8b3
...@@ -168,10 +168,13 @@ public class DispatcherServletAutoConfiguration { ...@@ -168,10 +168,13 @@ public class DispatcherServletAutoConfiguration {
} }
private ConditionOutcome checkDefaultDispatcherName(ConfigurableListableBeanFactory beanFactory) { private ConditionOutcome checkDefaultDispatcherName(ConfigurableListableBeanFactory beanFactory) {
boolean containsDispatcherBean = beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME);
if (!containsDispatcherBean) {
return ConditionOutcome.match();
}
List<String> servlets = Arrays List<String> servlets = Arrays
.asList(beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false)); .asList(beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false));
boolean containsDispatcherBean = beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); if (!servlets.contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {
if (containsDispatcherBean && !servlets.contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {
return ConditionOutcome.noMatch( return ConditionOutcome.noMatch(
startMessage().found("non dispatcher servlet").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)); startMessage().found("non dispatcher servlet").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment