Restored original detectHandlerMethods call chain for backwards compatibility with custom subclasses (such as in Spring Integration)

master
Juergen Hoeller 11 years ago
parent 32e5f57e64
commit 34d397efa9
  1. 20
      spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java

@ -104,9 +104,8 @@ public abstract class AbstractHandlerMethodMapping<T> 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<T> extends AbstractHandlerMap
/**
* Look for handler methods in a handler.
* <p>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<Method> methods = HandlerMethodSelector.selectMethods(userType, new MethodFilter() {
@Override
@ -342,9 +333,8 @@ public abstract class AbstractHandlerMethodMapping<T> 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<T> extends AbstractHandlerMap
private final HandlerMethod handlerMethod;
private Match(T mapping, HandlerMethod handlerMethod) {
public Match(T mapping, HandlerMethod handlerMethod) {
this.mapping = mapping;
this.handlerMethod = handlerMethod;
}

Loading…
Cancel
Save