fixed getBeansWithAnnotation to ignore beans with non-determinable type (SPR-6579)

This commit is contained in:
Juergen Hoeller
2009-12-23 19:11:19 +00:00
parent f3274624b3
commit bddb38d787
2 changed files with 38 additions and 3 deletions

View File

@@ -425,7 +425,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
* if not found on the exposed bean reference (e.g. in case of a proxy).
*/
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) {
A ann = AnnotationUtils.findAnnotation(getType(beanName), annotationType);
A ann = null;
Class beanType = getType(beanName);
if (beanType != null) {
ann = AnnotationUtils.findAnnotation(beanType, annotationType);
}
if (ann == null && containsBeanDefinition(beanName)) {
BeanDefinition bd = getMergedBeanDefinition(beanName);
if (bd instanceof AbstractBeanDefinition) {