fixed regression: looking for annotation on original bean class as well, not just on exposed bean type (SPR-5981)

This commit is contained in:
Juergen Hoeller
2009-09-24 14:59:26 +00:00
parent ad492e906e
commit e2093a8414
3 changed files with 67 additions and 13 deletions

View File

@@ -214,15 +214,14 @@ public class QualifierAnnotationAutowireCandidateResolver implements AutowireCan
}
if (targetAnnotation == null) {
// look for matching annotation on the target class
Class<?> beanType = null;
if (this.beanFactory != null) {
beanType = this.beanFactory.getType(bdHolder.getBeanName());
Class<?> beanType = this.beanFactory.getType(bdHolder.getBeanName());
if (beanType != null) {
targetAnnotation = ClassUtils.getUserClass(beanType).getAnnotation(type);
}
}
else if (bd.hasBeanClass()) {
beanType = bd.getBeanClass();
}
if (beanType != null) {
targetAnnotation = ClassUtils.getUserClass(beanType).getAnnotation(type);
if (targetAnnotation == null && bd.hasBeanClass()) {
targetAnnotation = ClassUtils.getUserClass(bd.getBeanClass()).getAnnotation(type);
}
}
if (targetAnnotation != null && targetAnnotation.equals(annotation)) {