From 71946f9d83bea2eae1197629c7cc7ca8f0c72435 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 20 Aug 2013 10:17:09 -0700 Subject: [PATCH] Update WebMvcAutoConfiguration conditional bean Change WebMvcAutoConfiguration to use WebMvcConfigurationSupport instead of HanderAdapter as the @ConditionalOnMissingBean. This allows MVC to be auto-configured even if you define additional HanderAdapters. Issue: #55493342 --- .../boot/autoconfigure/web/WebMvcAutoConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java index 5af7b06f07..a92a03af12 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java @@ -47,12 +47,12 @@ import org.springframework.format.FormatterRegistry; import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.servlet.DispatcherServlet; -import org.springframework.web.servlet.HandlerAdapter; import org.springframework.web.servlet.View; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import org.springframework.web.servlet.resource.ResourceHttpRequestHandler; @@ -69,7 +69,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @ConditionalOnClass({ Servlet.class, DispatcherServlet.class, WebMvcConfigurerAdapter.class }) -@ConditionalOnMissingBean({ HandlerAdapter.class }) +@ConditionalOnMissingBean(WebMvcConfigurationSupport.class) @Order(Ordered.HIGHEST_PRECEDENCE + 10) @AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class) public class WebMvcAutoConfiguration {