Browse Source

consistent handling of handler methods, init binder methods and model attribute methods (SPR-7355)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3730 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
219fc737fe
  1. 14
      org.springframework.web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java

14
org.springframework.web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java

@ -89,10 +89,12 @@ public class HandlerMethodResolver { @@ -89,10 +89,12 @@ public class HandlerMethodResolver {
(bridgedMethod == specificMethod || !isHandlerMethod(bridgedMethod))) {
handlerMethods.add(specificMethod);
}
else if (method.isAnnotationPresent(InitBinder.class)) {
else if (isInitBinderMethod(specificMethod) &&
(bridgedMethod == specificMethod || !isInitBinderMethod(bridgedMethod))) {
initBinderMethods.add(specificMethod);
}
else if (method.isAnnotationPresent(ModelAttribute.class)) {
else if (isModelAttributeMethod(specificMethod) &&
(bridgedMethod == specificMethod || !isModelAttributeMethod(bridgedMethod))) {
modelAttributeMethods.add(specificMethod);
}
}
@ -111,6 +113,14 @@ public class HandlerMethodResolver { @@ -111,6 +113,14 @@ public class HandlerMethodResolver {
return AnnotationUtils.findAnnotation(method, RequestMapping.class) != null;
}
protected boolean isInitBinderMethod(Method method) {
return AnnotationUtils.findAnnotation(method, InitBinder.class) != null;
}
protected boolean isModelAttributeMethod(Method method) {
return AnnotationUtils.findAnnotation(method, ModelAttribute.class) != null;
}
public final boolean hasHandlerMethods() {
return !this.handlerMethods.isEmpty();

Loading…
Cancel
Save