From 34d397efa9e6bbd9f22b529c6a0b4a9922fee29e Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 14 Feb 2014 01:30:16 +0100 Subject: [PATCH] Restored original detectHandlerMethods call chain for backwards compatibility with custom subclasses (such as in Spring Integration) --- .../handler/AbstractHandlerMethodMapping.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java index 3b2924fba5..145fb0ab3a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java @@ -104,9 +104,8 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap getApplicationContext().getBeanNamesForType(Object.class)); for (String beanName : beanNames) { - Class candidateType = getApplicationContext().getType(beanName); - if (isHandler(candidateType)){ - detectHandlerMethods(beanName, candidateType); + if (isHandler(getApplicationContext().getType(beanName))){ + detectHandlerMethods(beanName); } } handlerMethodsInitialized(getHandlerMethods()); @@ -121,20 +120,12 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap /** * Look for handler methods in a handler. - *

Delegates to {@link #detectHandlerMethods(Object, Class)} for actual processing. * @param handler the bean name of a handler or a handler instance */ protected void detectHandlerMethods(final Object handler) { Class handlerType = (handler instanceof String ? getApplicationContext().getType((String) handler) : handler.getClass()); - detectHandlerMethods(handler, handlerType); - } - /** - * Look for handler methods in a handler, against a pre-resolved type. - * @param handler the bean name of a handler or a handler instance - */ - protected void detectHandlerMethods(Object handler, Class handlerType) { final Class userType = ClassUtils.getUserClass(handlerType); Set methods = HandlerMethodSelector.selectMethods(userType, new MethodFilter() { @Override @@ -342,9 +333,8 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap /** - * A thin wrapper around a matched HandlerMethod and its matched mapping for - * the purpose of comparing the best match with a comparator in the context - * of the current request. + * A thin wrapper around a matched HandlerMethod and its mapping, for the purpose of + * comparing the best match with a comparator in the context of the current request. */ private class Match { @@ -352,7 +342,7 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap private final HandlerMethod handlerMethod; - private Match(T mapping, HandlerMethod handlerMethod) { + public Match(T mapping, HandlerMethod handlerMethod) { this.mapping = mapping; this.handlerMethod = handlerMethod; }