Skip to content

Commit 5a6c081

Browse files
committed
Clarify FactoryBean initialization effect in getBeanNamesForAnnotation
Issue: SPR-17392 (cherry picked from commit da23505)
1 parent c73b98c commit 5a6c081

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -244,7 +244,9 @@ <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSin
244244

245245
/**
246246
* Find all names of beans whose {@code Class} has the supplied {@link Annotation}
247-
* type, without creating any bean instances yet.
247+
* type, without creating corresponding bean instances yet.
248+
* <p>Note that this method considers objects created by FactoryBeans, which means
249+
* that FactoryBeans will get initialized in order to determine their object type.
248250
* @param annotationType the type of annotation to look for
249251
* @return the names of all matching beans
250252
* @since 4.0
@@ -254,6 +256,8 @@ <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSin
254256
/**
255257
* Find all beans whose {@code Class} has the supplied {@link Annotation} type,
256258
* returning a Map of bean names with corresponding bean instances.
259+
* <p>Note that this method considers objects created by FactoryBeans, which means
260+
* that FactoryBeans will get initialized in order to determine their object type.
257261
* @param annotationType the type of annotation to look for
258262
* @return a Map with the matching beans, containing the bean names as
259263
* keys and the corresponding bean instances as values

0 commit comments

Comments
 (0)