Avoid duplicate class introspection during findAnnotationOnBean

Closes gh-22318

(cherry picked from commit ca7634dfe8)
This commit is contained in:
Juergen Hoeller
2019-02-05 00:42:24 +01:00
parent 48c5b1e373
commit 4b6558c7e5

View File

@@ -584,7 +584,10 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if (bd instanceof AbstractBeanDefinition) {
AbstractBeanDefinition abd = (AbstractBeanDefinition) bd;
if (abd.hasBeanClass()) {
ann = AnnotationUtils.findAnnotation(abd.getBeanClass(), annotationType);
Class<?> beanClass = abd.getBeanClass();
if (beanClass != beanType) {
ann = AnnotationUtils.findAnnotation(beanClass, annotationType);
}
}
}
}