Skip to content

Commit 34d397e

Browse files
committed
Restored original detectHandlerMethods call chain for backwards compatibility with custom subclasses (such as in Spring Integration)
1 parent 32e5f57 commit 34d397e

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ protected void initHandlerMethods() {
104104
getApplicationContext().getBeanNamesForType(Object.class));
105105

106106
for (String beanName : beanNames) {
107-
Class<?> candidateType = getApplicationContext().getType(beanName);
108-
if (isHandler(candidateType)){
109-
detectHandlerMethods(beanName, candidateType);
107+
if (isHandler(getApplicationContext().getType(beanName))){
108+
detectHandlerMethods(beanName);
110109
}
111110
}
112111
handlerMethodsInitialized(getHandlerMethods());
@@ -121,20 +120,12 @@ protected void initHandlerMethods() {
121120

122121
/**
123122
* Look for handler methods in a handler.
124-
* <p>Delegates to {@link #detectHandlerMethods(Object, Class)} for actual processing.
125123
* @param handler the bean name of a handler or a handler instance
126124
*/
127125
protected void detectHandlerMethods(final Object handler) {
128126
Class<?> handlerType =
129127
(handler instanceof String ? getApplicationContext().getType((String) handler) : handler.getClass());
130-
detectHandlerMethods(handler, handlerType);
131-
}
132128

133-
/**
134-
* Look for handler methods in a handler, against a pre-resolved type.
135-
* @param handler the bean name of a handler or a handler instance
136-
*/
137-
protected void detectHandlerMethods(Object handler, Class<?> handlerType) {
138129
final Class<?> userType = ClassUtils.getUserClass(handlerType);
139130
Set<Method> methods = HandlerMethodSelector.selectMethods(userType, new MethodFilter() {
140131
@Override
@@ -342,17 +333,16 @@ protected HandlerMethod handleNoMatch(Set<T> mappings, String lookupPath, HttpSe
342333

343334

344335
/**
345-
* A thin wrapper around a matched HandlerMethod and its matched mapping for
346-
* the purpose of comparing the best match with a comparator in the context
347-
* of the current request.
336+
* A thin wrapper around a matched HandlerMethod and its mapping, for the purpose of
337+
* comparing the best match with a comparator in the context of the current request.
348338
*/
349339
private class Match {
350340

351341
private final T mapping;
352342

353343
private final HandlerMethod handlerMethod;
354344

355-
private Match(T mapping, HandlerMethod handlerMethod) {
345+
public Match(T mapping, HandlerMethod handlerMethod) {
356346
this.mapping = mapping;
357347
this.handlerMethod = handlerMethod;
358348
}

0 commit comments

Comments
 (0)