|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -730,14 +730,23 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) |
|
|
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) |
|
|
|
throws NoSuchBeanDefinitionException { |
|
|
|
throws NoSuchBeanDefinitionException { |
|
|
|
|
|
|
|
|
|
|
|
return findMergedAnnotationOnBean(beanName, annotationType) |
|
|
|
return findAnnotationOnBean(beanName, annotationType, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
|
|
|
public <A extends Annotation> A findAnnotationOnBean( |
|
|
|
|
|
|
|
String beanName, Class<A> annotationType, boolean allowFactoryBeanInit) |
|
|
|
|
|
|
|
throws NoSuchBeanDefinitionException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return findMergedAnnotationOnBean(beanName, annotationType, allowFactoryBeanInit) |
|
|
|
.synthesize(MergedAnnotation::isPresent).orElse(null); |
|
|
|
.synthesize(MergedAnnotation::isPresent).orElse(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private <A extends Annotation> MergedAnnotation<A> findMergedAnnotationOnBean( |
|
|
|
private <A extends Annotation> MergedAnnotation<A> findMergedAnnotationOnBean( |
|
|
|
String beanName, Class<A> annotationType) { |
|
|
|
String beanName, Class<A> annotationType, boolean allowFactoryBeanInit) { |
|
|
|
|
|
|
|
|
|
|
|
Class<?> beanType = getType(beanName); |
|
|
|
Class<?> beanType = getType(beanName, allowFactoryBeanInit); |
|
|
|
if (beanType != null) { |
|
|
|
if (beanType != null) { |
|
|
|
MergedAnnotation<A> annotation = |
|
|
|
MergedAnnotation<A> annotation = |
|
|
|
MergedAnnotations.from(beanType, SearchStrategy.TYPE_HIERARCHY).get(annotationType); |
|
|
|
MergedAnnotations.from(beanType, SearchStrategy.TYPE_HIERARCHY).get(annotationType); |
|
|
|
|