From 5de51980053445a29f84e78897ceb454a56c9931 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Wed, 9 Oct 2013 14:46:46 +0200 Subject: [PATCH] Allow greater flexibility for template method createDataBinderFactory Prior to this commit, the template method createDataBinderFactory would only allow ServletRequestDataBinderFactory as a return type. This commit updates the method signature and allows InitBinderDataBinderFactory, a superclass of the previous one. Then other implementations can override this method and return other InitBinderDataBinderFactory types. Issue: SPR-10920 --- .../method/annotation/RequestMappingHandlerAdapter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java index 65210db2a4..4d2de70c26 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java @@ -73,6 +73,7 @@ import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethodSelector; import org.springframework.web.method.annotation.ErrorsMethodArgumentResolver; import org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver; +import org.springframework.web.method.annotation.InitBinderDataBinderFactory; import org.springframework.web.method.annotation.MapMethodProcessor; import org.springframework.web.method.annotation.ModelAttributeMethodProcessor; import org.springframework.web.method.annotation.ModelFactory; @@ -826,14 +827,14 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter i } /** - * Template method to create a new ServletRequestDataBinderFactory instance. + * Template method to create a new InitBinderDataBinderFactory instance. *

The default implementation creates a ServletRequestDataBinderFactory. * This can be overridden for custom ServletRequestDataBinder subclasses. * @param binderMethods {@code @InitBinder} methods - * @return the ServletRequestDataBinderFactory instance to use + * @return the InitBinderDataBinderFactory instance to use * @throws Exception in case of invalid state or arguments */ - protected ServletRequestDataBinderFactory createDataBinderFactory(List binderMethods) + protected InitBinderDataBinderFactory createDataBinderFactory(List binderMethods) throws Exception { return new ServletRequestDataBinderFactory(binderMethods, getWebBindingInitializer());