From ffe9bae1382e326e2ff69053f2bbf3600d1a5614 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 7 Mar 2017 20:50:10 -0500 Subject: [PATCH] Update Javadoc on exception resolvers in MVC config Issue: SPR-15324 --- .../config/annotation/WebMvcConfigurer.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java index 7e21c63d8a5..ad3c33c9673 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java @@ -167,19 +167,29 @@ public interface WebMvcConfigurer { void extendMessageConverters(List> converters); /** - * Configure the {@link HandlerExceptionResolver}s to handle unresolved - * controller exceptions. If no resolvers are added to the list, default - * exception resolvers are added instead. + * Configure exception resolvers. + *

The given list starts out empty. If it is left empty, the framework + * configures a default set of resolvers, see + * {@link WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List)}. + * Or if any exception resolvers are added to the list, then the application + * effectively takes over and must provide, fully initialized, exception + * resolvers. + *

Alternatively you can use + * {@link #extendHandlerExceptionResolvers(List)} which allows you to extend + * or modify the list of exception resolvers configured by default. * @param exceptionResolvers initially an empty list + * @see #extendHandlerExceptionResolvers(List) + * @see WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List) */ void configureHandlerExceptionResolvers(List exceptionResolvers); /** - * A hook for extending or modifying the list of {@link HandlerExceptionResolver}s - * after it has been configured. This may be useful for example to allow default - * resolvers to be registered and then insert a custom one through this method. + * Extending or modify the list of exception resolvers configured by default. + * This can be useful for inserting a custom exception resolver without + * interfering with default ones. * @param exceptionResolvers the list of configured resolvers to extend * @since 4.3 + * @see WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List) */ void extendHandlerExceptionResolvers(List exceptionResolvers);