1
1
/*
2
- * Copyright 2002-2022 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.
39
39
* (which the methods defined on the ListableBeanFactory interface don't,
40
40
* in contrast to the methods defined on the BeanFactory interface).
41
41
*
42
+ * <p><b>NOTE:</b> It is generally preferable to use {@link ObjectProvider#stream()}
43
+ * via {@link BeanFactory#getBeanProvider} instead of this utility class.
44
+ *
42
45
* @author Rod Johnson
43
46
* @author Juergen Hoeller
44
47
* @author Chris Beams
45
48
* @since 04.07.2003
49
+ * @see BeanFactory#getBeanProvider
46
50
*/
47
51
public abstract class BeanFactoryUtils {
48
52
@@ -308,7 +312,7 @@ public static String[] beanNamesForAnnotationIncludingAncestors(
308
312
* 'replacing' beans by explicitly choosing the same bean name in a child factory;
309
313
* the bean in the ancestor factory won't be visible then, not even for by-type lookups.
310
314
* @param lbf the bean factory
311
- * @param type type of bean to match
315
+ * @param type the type of bean to match
312
316
* @return the Map of matching bean instances, or an empty Map if none
313
317
* @throws BeansException if a bean could not be created
314
318
* @see ListableBeanFactory#getBeansOfType(Class)
@@ -347,7 +351,7 @@ public static <T> Map<String, T> beansOfTypeIncludingAncestors(ListableBeanFacto
347
351
* 'replacing' beans by explicitly choosing the same bean name in a child factory;
348
352
* the bean in the ancestor factory won't be visible then, not even for by-type lookups.
349
353
* @param lbf the bean factory
350
- * @param type type of bean to match
354
+ * @param type the type of bean to match
351
355
* @param includeNonSingletons whether to include prototype or scoped beans too
352
356
* or just singletons (also applies to FactoryBeans)
353
357
* @param allowEagerInit whether to initialize <i>lazy-init singletons</i> and
@@ -395,7 +399,7 @@ public static <T> Map<String, T> beansOfTypeIncludingAncestors(
395
399
* 'replacing' beans by explicitly choosing the same bean name in a child factory;
396
400
* the bean in the ancestor factory won't be visible then, not even for by-type lookups.
397
401
* @param lbf the bean factory
398
- * @param type type of bean to match
402
+ * @param type the type of bean to match
399
403
* @return the matching bean instance
400
404
* @throws NoSuchBeanDefinitionException if no bean of the given type was found
401
405
* @throws NoUniqueBeanDefinitionException if more than one bean of the given type was found
@@ -425,7 +429,7 @@ public static <T> T beanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class<
425
429
* 'replacing' beans by explicitly choosing the same bean name in a child factory;
426
430
* the bean in the ancestor factory won't be visible then, not even for by-type lookups.
427
431
* @param lbf the bean factory
428
- * @param type type of bean to match
432
+ * @param type the type of bean to match
429
433
* @param includeNonSingletons whether to include prototype or scoped beans too
430
434
* or just singletons (also applies to FactoryBeans)
431
435
* @param allowEagerInit whether to initialize <i>lazy-init singletons</i> and
@@ -457,7 +461,7 @@ public static <T> T beanOfTypeIncludingAncestors(
457
461
* <p>This version of {@code beanOfType} automatically includes
458
462
* prototypes and FactoryBeans.
459
463
* @param lbf the bean factory
460
- * @param type type of bean to match
464
+ * @param type the type of bean to match
461
465
* @return the matching bean instance
462
466
* @throws NoSuchBeanDefinitionException if no bean of the given type was found
463
467
* @throws NoUniqueBeanDefinitionException if more than one bean of the given type was found
@@ -481,7 +485,7 @@ public static <T> T beanOfType(ListableBeanFactory lbf, Class<T> type) throws Be
481
485
* only raw FactoryBeans will be checked (which doesn't require initialization
482
486
* of each FactoryBean).
483
487
* @param lbf the bean factory
484
- * @param type type of bean to match
488
+ * @param type the type of bean to match
485
489
* @param includeNonSingletons whether to include prototype or scoped beans too
486
490
* or just singletons (also applies to FactoryBeans)
487
491
* @param allowEagerInit whether to initialize <i>lazy-init singletons</i> and
@@ -529,7 +533,7 @@ private static String[] mergeNamesWithParent(String[] result, String[] parentRes
529
533
530
534
/**
531
535
* Extract a unique bean for the given type from the given Map of matching beans.
532
- * @param type type of bean to match
536
+ * @param type the type of bean to match
533
537
* @param matchingBeans all matching beans found
534
538
* @return the unique bean instance
535
539
* @throws NoSuchBeanDefinitionException if no bean of the given type was found
0 commit comments