Skip to content

Commit d39e3cc

Browse files
committed
Merge branch '5.1.x'
2 parents e0fe32a + 9ea02c6 commit d39e3cc

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSin
243243
throws BeansException;
244244

245245
/**
246-
* Find all names of beans whose {@code Class} has the supplied {@link Annotation}
246+
* Find all names of beans which are annotated with the supplied {@link Annotation}
247247
* type, without creating corresponding bean instances yet.
248248
* <p>Note that this method considers objects created by FactoryBeans, which means
249249
* that FactoryBeans will get initialized in order to determine their object type.
@@ -256,7 +256,7 @@ <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSin
256256
String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType);
257257

258258
/**
259-
* Find all beans whose {@code Class} has the supplied {@link Annotation} type,
259+
* Find all beans which are annotated with the supplied {@link Annotation} type,
260260
* returning a Map of bean names with corresponding bean instances.
261261
* <p>Note that this method considers objects created by FactoryBeans, which means
262262
* that FactoryBeans will get initialized in order to determine their object type.

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,6 @@ public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> an
658658
return result;
659659
}
660660

661-
/**
662-
* Find a {@link Annotation} of {@code annotationType} on the specified
663-
* bean, traversing its interfaces and super classes if no annotation can be
664-
* found on the given class itself, as well as checking its raw bean class
665-
* if not found on the exposed bean reference (e.g. in case of a proxy).
666-
*/
667661
@Override
668662
@Nullable
669663
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
@@ -686,6 +680,7 @@ private <A extends Annotation> MergedAnnotation<A> findMergedAnnotationOnBean(
686680
}
687681
if (containsBeanDefinition(beanName)) {
688682
RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName);
683+
// Check raw bean class, e.g. in case of a proxy.
689684
if (bd.hasBeanClass()) {
690685
Class<?> beanClass = bd.getBeanClass();
691686
if (beanClass != beanType) {
@@ -696,6 +691,7 @@ private <A extends Annotation> MergedAnnotation<A> findMergedAnnotationOnBean(
696691
}
697692
}
698693
}
694+
// Check annotations declared on factory method, if any.
699695
Method factoryMethod = bd.getResolvedFactoryMethod();
700696
if (factoryMethod != null) {
701697
MergedAnnotation<A> annotation =

spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@
433433
* is registered as a traditional XML bean definition, the name/id of the bean
434434
* element will take precedence.
435435
* @return the explicit component name, if any (or empty String otherwise)
436-
* @see org.springframework.beans.factory.support.DefaultBeanNameGenerator
436+
* @see AnnotationBeanNameGenerator
437437
*/
438438
@AliasFor(annotation = Component.class)
439439
String value() default "";

0 commit comments

Comments
 (0)