From b9786ccacac2cf90e7fa10a9a74a42c603376f4c Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Thu, 5 Jul 2012 16:02:36 -0400 Subject: [PATCH] Fix minor issue in HandlerMethod Before this change HandlerMethod used ClassUtils.getUserClass(Class) to get the real user class, and not one generated by CGlib. However it failed to that under all circumstances. This change fixes that. Issue: SPR-9490 --- .../web/method/HandlerMethod.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java b/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java index 8417945de11..17d01fcf180 100644 --- a/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java +++ b/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java @@ -124,13 +124,10 @@ public class HandlerMethod { * Note that if the bean type is a CGLIB-generated class, the original, user-defined class is returned. */ public Class getBeanType() { - if (bean instanceof String) { - String beanName = (String) bean; - return beanFactory.getType(beanName); - } - else { - return ClassUtils.getUserClass(bean.getClass()); - } + Class clazz = (this.bean instanceof String) + ? this.beanFactory.getType((String) this.bean) : this.bean.getClass(); + + return ClassUtils.getUserClass(clazz); } /** @@ -138,7 +135,7 @@ public class HandlerMethod { * Otherwise it returns the same method as {@link #getMethod()}. */ protected Method getBridgedMethod() { - return bridgedMethod; + return this.bridgedMethod; } /** @@ -153,7 +150,7 @@ public class HandlerMethod { } this.parameters = p; } - return parameters; + return this.parameters; } /** @@ -197,7 +194,7 @@ public class HandlerMethod { String beanName = (String) this.bean; handler = this.beanFactory.getBean(beanName); } - return new HandlerMethod(handler, method); + return new HandlerMethod(handler, this.method); } @Override