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