@ -119,6 +119,7 @@ import org.springframework.web.servlet.resource.AppCacheManifestTransformer;
import org.springframework.web.servlet.resource.EncodedResourceResolver ;
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler ;
import org.springframework.web.servlet.resource.ResourceResolver ;
import org.springframework.web.servlet.resource.ResourceUrlProvider ;
import org.springframework.web.servlet.resource.VersionResourceResolver ;
import org.springframework.web.servlet.view.BeanNameViewResolver ;
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver ;
@ -466,7 +467,7 @@ public class WebMvcAutoConfiguration {
/ * *
* Configuration equivalent to { @code @EnableWebMvc } .
* /
@Configuration
@Configuration ( proxyBeanMethods = false )
public static class EnableWebMvcConfiguration extends DelegatingWebMvcConfiguration {
private final WebMvcProperties mvcProperties ;
@ -486,8 +487,12 @@ public class WebMvcAutoConfiguration {
@Bean
@Override
public RequestMappingHandlerAdapter requestMappingHandlerAdapter ( ) {
RequestMappingHandlerAdapter adapter = super . requestMappingHandlerAdapter ( ) ;
public RequestMappingHandlerAdapter requestMappingHandlerAdapter (
ContentNegotiationManager mvcContentNegotiationManager ,
FormattingConversionService mvcConversionService ,
Validator mvcValidator ) {
RequestMappingHandlerAdapter adapter = super . requestMappingHandlerAdapter (
mvcContentNegotiationManager , mvcConversionService , mvcValidator ) ;
adapter . setIgnoreDefaultModelOnRedirect ( this . mvcProperties = = null
| | this . mvcProperties . isIgnoreDefaultModelOnRedirect ( ) ) ;
return adapter ;
@ -505,9 +510,13 @@ public class WebMvcAutoConfiguration {
@Bean
@Primary
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping ( ) {
public RequestMappingHandlerMapping requestMappingHandlerMapping (
ContentNegotiationManager mvcContentNegotiationManager ,
FormattingConversionService mvcConversionService ,
ResourceUrlProvider mvcResourceUrlProvider ) {
// Must be @Primary for MvcUriComponentsBuilder to work
return super . requestMappingHandlerMapping ( ) ;
return super . requestMappingHandlerMapping ( mvcContentNegotiationManager ,
mvcConversionService , mvcResourceUrlProvider ) ;
}
@Bean
@ -539,12 +548,15 @@ public class WebMvcAutoConfiguration {
}
@Override
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer ( ) {
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer (
FormattingConversionService mvcConversionService ,
Validator mvcValidator ) {
try {
return this . beanFactory . getBean ( ConfigurableWebBindingInitializer . class ) ;
}
catch ( NoSuchBeanDefinitionException ex ) {
return super . getConfigurableWebBindingInitializer ( ) ;
return super . getConfigurableWebBindingInitializer ( mvcConversionService ,
mvcValidator ) ;
}
}
@ -558,12 +570,9 @@ public class WebMvcAutoConfiguration {
}
@Override
protected void configure HandlerExceptionResolvers(
protected void extend HandlerExceptionResolvers(
List < HandlerExceptionResolver > exceptionResolvers ) {
super . configureHandlerExceptionResolvers ( exceptionResolvers ) ;
if ( exceptionResolvers . isEmpty ( ) ) {
addDefaultHandlerExceptionResolvers ( exceptionResolvers ) ;
}
super . extendHandlerExceptionResolvers ( exceptionResolvers ) ;
if ( this . mvcProperties . isLogResolvedException ( ) ) {
for ( HandlerExceptionResolver resolver : exceptionResolvers ) {
if ( resolver instanceof AbstractHandlerExceptionResolver ) {