polishing

This commit is contained in:
Juergen Hoeller 2009-04-26 11:39:00 +00:00
parent 423809543a
commit ac16101f98
2 changed files with 4 additions and 7 deletions

View File

@ -367,15 +367,13 @@ 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) {
Class<?> handlerType = getType(beanName);
A ann = AnnotationUtils.findAnnotation(handlerType, annotationType);
A ann = AnnotationUtils.findAnnotation(getType(beanName), annotationType);
if (ann == null && containsBeanDefinition(beanName)) {
BeanDefinition bd = getMergedBeanDefinition(beanName);
if (bd instanceof AbstractBeanDefinition) {
AbstractBeanDefinition abd = (AbstractBeanDefinition) bd;
if (abd.hasBeanClass()) {
Class<?> beanClass = abd.getBeanClass();
ann = AnnotationUtils.findAnnotation(beanClass, annotationType);
ann = AnnotationUtils.findAnnotation(abd.getBeanClass(), annotationType);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -265,8 +265,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
}
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) {
Class<?> handlerType = getType(beanName);
return AnnotationUtils.findAnnotation(handlerType, annotationType);
return AnnotationUtils.findAnnotation(getType(beanName), annotationType);
}
}