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
This commit is contained in:
Rossen Stoyanchev 2012-07-05 16:02:36 -04:00
parent a4240d2864
commit b9786ccaca
1 changed files with 7 additions and 10 deletions

View File

@ -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. * Note that if the bean type is a CGLIB-generated class, the original, user-defined class is returned.
*/ */
public Class<?> getBeanType() { public Class<?> getBeanType() {
if (bean instanceof String) { Class<?> clazz = (this.bean instanceof String)
String beanName = (String) bean; ? this.beanFactory.getType((String) this.bean) : this.bean.getClass();
return beanFactory.getType(beanName);
} return ClassUtils.getUserClass(clazz);
else {
return ClassUtils.getUserClass(bean.getClass());
}
} }
/** /**
@ -138,7 +135,7 @@ public class HandlerMethod {
* Otherwise it returns the same method as {@link #getMethod()}. * Otherwise it returns the same method as {@link #getMethod()}.
*/ */
protected Method getBridgedMethod() { protected Method getBridgedMethod() {
return bridgedMethod; return this.bridgedMethod;
} }
/** /**
@ -153,7 +150,7 @@ public class HandlerMethod {
} }
this.parameters = p; this.parameters = p;
} }
return parameters; return this.parameters;
} }
/** /**
@ -197,7 +194,7 @@ public class HandlerMethod {
String beanName = (String) this.bean; String beanName = (String) this.bean;
handler = this.beanFactory.getBean(beanName); handler = this.beanFactory.getBean(beanName);
} }
return new HandlerMethod(handler, method); return new HandlerMethod(handler, this.method);
} }
@Override @Override