diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
index 497e71190c..7473330449 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
@@ -51,7 +51,6 @@ import org.springframework.util.ClassUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
-import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.accept.ContentNegotiationManager;
import org.springframework.web.bind.WebDataBinder;
@@ -88,49 +87,49 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
*
*
This class registers the following {@link HandlerMapping}s:
*
- * - {@link RequestMappingHandlerMapping}
- * ordered at 0 for mapping requests to annotated controller methods.
- *
- {@link HandlerMapping}
- * ordered at 1 to map URL paths directly to view names.
- *
- {@link BeanNameUrlHandlerMapping}
- * ordered at 2 to map URL paths to controller bean names.
- *
- {@link HandlerMapping}
- * ordered at {@code Integer.MAX_VALUE-1} to serve static resource requests.
- *
- {@link HandlerMapping}
- * ordered at {@code Integer.MAX_VALUE} to forward requests to the default servlet.
+ *
- {@link RequestMappingHandlerMapping}
+ * ordered at 0 for mapping requests to annotated controller methods.
+ *
- {@link HandlerMapping}
+ * ordered at 1 to map URL paths directly to view names.
+ *
- {@link BeanNameUrlHandlerMapping}
+ * ordered at 2 to map URL paths to controller bean names.
+ *
- {@link HandlerMapping}
+ * ordered at {@code Integer.MAX_VALUE-1} to serve static resource requests.
+ *
- {@link HandlerMapping}
+ * ordered at {@code Integer.MAX_VALUE} to forward requests to the default servlet.
*
*
* Registers these {@link HandlerAdapter}s:
*
- * - {@link RequestMappingHandlerAdapter}
- * for processing requests with annotated controller methods.
- *
- {@link HttpRequestHandlerAdapter}
- * for processing requests with {@link HttpRequestHandler}s.
- *
- {@link SimpleControllerHandlerAdapter}
- * for processing requests with interface-based {@link Controller}s.
+ *
- {@link RequestMappingHandlerAdapter}
+ * for processing requests with annotated controller methods.
+ *
- {@link HttpRequestHandlerAdapter}
+ * for processing requests with {@link HttpRequestHandler}s.
+ *
- {@link SimpleControllerHandlerAdapter}
+ * for processing requests with interface-based {@link Controller}s.
*
*
* Registers a {@link HandlerExceptionResolverComposite} with this chain of
* exception resolvers:
*
- * - {@link ExceptionHandlerExceptionResolver} for handling exceptions
- * through @{@link ExceptionHandler} methods.
- *
- {@link ResponseStatusExceptionResolver} for exceptions annotated
- * with @{@link ResponseStatus}.
- *
- {@link DefaultHandlerExceptionResolver} for resolving known Spring
- * exception types
+ *
- {@link ExceptionHandlerExceptionResolver} for handling exceptions
+ * through @{@link ExceptionHandler} methods.
+ *
- {@link ResponseStatusExceptionResolver} for exceptions annotated
+ * with @{@link ResponseStatus}.
+ *
- {@link DefaultHandlerExceptionResolver} for resolving known Spring
+ * exception types
*
*
* Both the {@link RequestMappingHandlerAdapter} and the
* {@link ExceptionHandlerExceptionResolver} are configured with default
* instances of the following by default:
*
- * - A {@link ContentNegotiationManager}
- *
- A {@link DefaultFormattingConversionService}
- *
- A {@link LocalValidatorFactoryBean} if a JSR-303 implementation is
- * available on the classpath
- *
- A range of {@link HttpMessageConverter}s depending on the 3rd party
- * libraries available on the classpath.
+ *
- a {@link ContentNegotiationManager}
+ *
- a {@link DefaultFormattingConversionService}
+ *
- a {@link org.springframework.validation.beanvalidation.LocalValidatorFactoryBean}
+ * if a JSR-303 implementation is available on the classpath
+ *
- a range of {@link HttpMessageConverter}s depending on the third-party
+ * libraries available on the classpath.
*
*
* @author Rossen Stoyanchev
@@ -343,9 +342,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* through annotated controller methods. Consider overriding one of these
* other more fine-grained methods:
*
- * - {@link #addArgumentResolvers} for adding custom argument resolvers.
- *
- {@link #addReturnValueHandlers} for adding custom return value handlers.
- *
- {@link #configureMessageConverters} for adding custom message converters.
+ *
- {@link #addArgumentResolvers} for adding custom argument resolvers.
+ *
- {@link #addReturnValueHandlers} for adding custom return value handlers.
+ *
- {@link #configureMessageConverters} for adding custom message converters.
*
*/
@Bean
@@ -612,23 +611,26 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* A method available to subclasses for adding default {@link HandlerExceptionResolver}s.
* Adds the following exception resolvers:
*
- * - {@link ExceptionHandlerExceptionResolver}
- * for handling exceptions through @{@link ExceptionHandler} methods.
- *
- {@link ResponseStatusExceptionResolver}
- * for exceptions annotated with @{@link ResponseStatus}.
- *
- {@link DefaultHandlerExceptionResolver}
- * for resolving known Spring exception types
+ *
- {@link ExceptionHandlerExceptionResolver}
+ * for handling exceptions through @{@link ExceptionHandler} methods.
+ *
- {@link ResponseStatusExceptionResolver}
+ * for exceptions annotated with @{@link ResponseStatus}.
+ *
- {@link DefaultHandlerExceptionResolver}
+ * for resolving known Spring exception types
*
*/
protected final void addDefaultHandlerExceptionResolvers(List exceptionResolvers) {
ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver = new ExceptionHandlerExceptionResolver();
- exceptionHandlerExceptionResolver.setApplicationContext(this.applicationContext);
exceptionHandlerExceptionResolver.setContentNegotiationManager(mvcContentNegotiationManager());
exceptionHandlerExceptionResolver.setMessageConverters(getMessageConverters());
+ exceptionHandlerExceptionResolver.setApplicationContext(this.applicationContext);
exceptionHandlerExceptionResolver.afterPropertiesSet();
-
exceptionResolvers.add(exceptionHandlerExceptionResolver);
- exceptionResolvers.add(new ResponseStatusExceptionResolver());
+
+ ResponseStatusExceptionResolver responseStatusExceptionResolver = new ResponseStatusExceptionResolver();
+ responseStatusExceptionResolver.setMessageSource(this.applicationContext);
+ exceptionResolvers.add(responseStatusExceptionResolver);
+
exceptionResolvers.add(new DefaultHandlerExceptionResolver());
}