1
1
/*
2
- * Copyright 2002-2024 the original author or authors.
2
+ * Copyright 2002-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -146,8 +146,6 @@ public interface ListableBeanFactory extends BeanFactory {
146
146
* <p>Does not consider any hierarchy this factory may participate in.
147
147
* Use BeanFactoryUtils' {@code beanNamesForTypeIncludingAncestors}
148
148
* to include beans in ancestor factories too.
149
- * <p>Note: Does <i>not</i> ignore singleton beans that have been registered
150
- * by other means than bean definitions.
151
149
* <p>This version of {@code getBeanNamesForType} matches all kinds of beans,
152
150
* be it singletons, prototypes, or FactoryBeans. In most implementations, the
153
151
* result will be the same as for {@code getBeanNamesForType(type, true, true)}.
@@ -177,8 +175,6 @@ public interface ListableBeanFactory extends BeanFactory {
177
175
* <p>Does not consider any hierarchy this factory may participate in.
178
176
* Use BeanFactoryUtils' {@code beanNamesForTypeIncludingAncestors}
179
177
* to include beans in ancestor factories too.
180
- * <p>Note: Does <i>not</i> ignore singleton beans that have been registered
181
- * by other means than bean definitions.
182
178
* <p>Bean names returned by this method should always return bean names <i>in the
183
179
* order of definition</i> in the backend configuration, as far as possible.
184
180
* @param type the generically typed class or interface to match
@@ -211,8 +207,6 @@ public interface ListableBeanFactory extends BeanFactory {
211
207
* <p>Does not consider any hierarchy this factory may participate in.
212
208
* Use BeanFactoryUtils' {@code beanNamesForTypeIncludingAncestors}
213
209
* to include beans in ancestor factories too.
214
- * <p>Note: Does <i>not</i> ignore singleton beans that have been registered
215
- * by other means than bean definitions.
216
210
* <p>This version of {@code getBeanNamesForType} matches all kinds of beans,
217
211
* be it singletons, prototypes, or FactoryBeans. In most implementations, the
218
212
* result will be the same as for {@code getBeanNamesForType(type, true, true)}.
@@ -240,8 +234,6 @@ public interface ListableBeanFactory extends BeanFactory {
240
234
* <p>Does not consider any hierarchy this factory may participate in.
241
235
* Use BeanFactoryUtils' {@code beanNamesForTypeIncludingAncestors}
242
236
* to include beans in ancestor factories too.
243
- * <p>Note: Does <i>not</i> ignore singleton beans that have been registered
244
- * by other means than bean definitions.
245
237
* <p>Bean names returned by this method should always return bean names <i>in the
246
238
* order of definition</i> in the backend configuration, as far as possible.
247
239
* @param type the class or interface to match, or {@code null} for all bean names
@@ -266,21 +258,24 @@ public interface ListableBeanFactory extends BeanFactory {
266
258
* subclasses), judging from either bean definitions or the value of
267
259
* {@code getObjectType} in the case of FactoryBeans.
268
260
* <p><b>NOTE: This method introspects top-level beans only.</b> It does <i>not</i>
269
- * check nested beans which might match the specified type as well.
261
+ * check nested beans which might match the specified type as well. Also, it
262
+ * <b>suppresses exceptions for beans that are currently in creation in a circular
263
+ * reference scenario:</b> typically, references back to the caller of this method.
270
264
* <p>Does consider objects created by FactoryBeans, which means that FactoryBeans
271
265
* will get initialized. If the object created by the FactoryBean doesn't match,
272
266
* the raw FactoryBean itself will be matched against the type.
273
267
* <p>Does not consider any hierarchy this factory may participate in.
274
268
* Use BeanFactoryUtils' {@code beansOfTypeIncludingAncestors}
275
269
* to include beans in ancestor factories too.
276
- * <p>Note: Does <i>not</i> ignore singleton beans that have been registered
277
- * by other means than bean definitions.
278
270
* <p>This version of getBeansOfType matches all kinds of beans, be it
279
271
* singletons, prototypes, or FactoryBeans. In most implementations, the
280
272
* result will be the same as for {@code getBeansOfType(type, true, true)}.
281
273
* <p>The Map returned by this method should always return bean names and
282
274
* corresponding bean instances <i>in the order of definition</i> in the
283
275
* backend configuration, as far as possible.
276
+ * <p><b>Consider {@link #getBeanNamesForType(Class)} with selective {@link #getBean}
277
+ * calls for specific bean names in preference to this Map-based retrieval method.</b>
278
+ * Aside from lazy instantiation benefits, this also avoids any exception suppression.
284
279
* @param type the class or interface to match, or {@code null} for all concrete beans
285
280
* @return a Map with the matching beans, containing the bean names as
286
281
* keys and the corresponding bean instances as values
@@ -296,7 +291,9 @@ public interface ListableBeanFactory extends BeanFactory {
296
291
* subclasses), judging from either bean definitions or the value of
297
292
* {@code getObjectType} in the case of FactoryBeans.
298
293
* <p><b>NOTE: This method introspects top-level beans only.</b> It does <i>not</i>
299
- * check nested beans which might match the specified type as well.
294
+ * check nested beans which might match the specified type as well. Also, it
295
+ * <b>suppresses exceptions for beans that are currently in creation in a circular
296
+ * reference scenario:</b> typically, references back to the caller of this method.
300
297
* <p>Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set,
301
298
* which means that FactoryBeans will get initialized. If the object created by the
302
299
* FactoryBean doesn't match, the raw FactoryBean itself will be matched against the
@@ -305,11 +302,12 @@ public interface ListableBeanFactory extends BeanFactory {
305
302
* <p>Does not consider any hierarchy this factory may participate in.
306
303
* Use BeanFactoryUtils' {@code beansOfTypeIncludingAncestors}
307
304
* to include beans in ancestor factories too.
308
- * <p>Note: Does <i>not</i> ignore singleton beans that have been registered
309
- * by other means than bean definitions.
310
305
* <p>The Map returned by this method should always return bean names and
311
306
* corresponding bean instances <i>in the order of definition</i> in the
312
307
* backend configuration, as far as possible.
308
+ * <p><b>Consider {@link #getBeanNamesForType(Class)} with selective {@link #getBean}
309
+ * calls for specific bean names in preference to this Map-based retrieval method.</b>
310
+ * Aside from lazy instantiation benefits, this also avoids any exception suppression.
313
311
* @param type the class or interface to match, or {@code null} for all concrete beans
314
312
* @param includeNonSingletons whether to include prototype or scoped beans too
315
313
* or just singletons (also applies to FactoryBeans)
0 commit comments