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 3b2924fba56..145fb0ab3a0 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; }