|
|
|
@ -656,12 +656,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Find a {@link Annotation} of {@code annotationType} on the specified |
|
|
|
|
|
|
|
* bean, traversing its interfaces and super classes if no annotation can be |
|
|
|
|
|
|
|
* found on the given class itself, as well as checking its raw bean class
|
|
|
|
|
|
|
|
* if not found on the exposed bean reference (e.g. in case of a proxy). |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) |
|
|
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) |
|
|
|
@ -673,14 +667,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
ann = AnnotationUtils.findAnnotation(beanType, annotationType); |
|
|
|
ann = AnnotationUtils.findAnnotation(beanType, annotationType); |
|
|
|
} |
|
|
|
} |
|
|
|
if (ann == null && containsBeanDefinition(beanName)) { |
|
|
|
if (ann == null && containsBeanDefinition(beanName)) { |
|
|
|
BeanDefinition bd = getMergedBeanDefinition(beanName); |
|
|
|
// Check raw bean class, e.g. in case of a proxy.
|
|
|
|
if (bd instanceof AbstractBeanDefinition) { |
|
|
|
RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName); |
|
|
|
AbstractBeanDefinition abd = (AbstractBeanDefinition) bd; |
|
|
|
if (bd.hasBeanClass()) { |
|
|
|
if (abd.hasBeanClass()) { |
|
|
|
Class<?> beanClass = bd.getBeanClass(); |
|
|
|
Class<?> beanClass = abd.getBeanClass(); |
|
|
|
if (beanClass != beanType) { |
|
|
|
if (beanClass != beanType) { |
|
|
|
ann = AnnotationUtils.findAnnotation(beanClass, annotationType); |
|
|
|
ann = AnnotationUtils.findAnnotation(beanClass, annotationType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1975,10 +1967,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public Object getOrderSource(Object obj) { |
|
|
|
public Object getOrderSource(Object obj) { |
|
|
|
RootBeanDefinition beanDefinition = getRootBeanDefinition(this.instancesToBeanNames.get(obj)); |
|
|
|
String beanName = this.instancesToBeanNames.get(obj); |
|
|
|
if (beanDefinition == null) { |
|
|
|
if (beanName == null || !containsBeanDefinition(beanName)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
RootBeanDefinition beanDefinition = getMergedLocalBeanDefinition(beanName); |
|
|
|
List<Object> sources = new ArrayList<>(2); |
|
|
|
List<Object> sources = new ArrayList<>(2); |
|
|
|
Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); |
|
|
|
Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); |
|
|
|
if (factoryMethod != null) { |
|
|
|
if (factoryMethod != null) { |
|
|
|
@ -1990,17 +1983,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
} |
|
|
|
} |
|
|
|
return sources.toArray(); |
|
|
|
return sources.toArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
|
|
|
private RootBeanDefinition getRootBeanDefinition(@Nullable String beanName) { |
|
|
|
|
|
|
|
if (beanName != null && containsBeanDefinition(beanName)) { |
|
|
|
|
|
|
|
BeanDefinition bd = getMergedBeanDefinition(beanName); |
|
|
|
|
|
|
|
if (bd instanceof RootBeanDefinition) { |
|
|
|
|
|
|
|
return (RootBeanDefinition) bd; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|