Browse Source

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
pull/104/head
Rossen Stoyanchev 14 years ago
parent
commit
b9786ccaca
  1. 17
      spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java

17
spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java

@ -124,13 +124,10 @@ public class HandlerMethod { @@ -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 { @@ -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 { @@ -153,7 +150,7 @@ public class HandlerMethod {
}
this.parameters = p;
}
return parameters;
return this.parameters;
}
/**
@ -197,7 +194,7 @@ public class HandlerMethod { @@ -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

Loading…
Cancel
Save