提交 ac16101f 编写于 作者: J Juergen Hoeller

polishing

上级 42380954
......@@ -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);
}
}
}
......
/*
* 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);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册