ListableBeanFactory interface.
Returns bean counts, bean names or bean instances, taking into account the nesting hierarchy of a bean factory (which the methods defined on the ListableBeanFactory interface don't, in contrast to the methods defined on the BeanFactory interface).
name the name of the beanBeanFactory.FACTORY_BEAN_PREFIXname the name of the beanBeanFactory.FACTORY_BEAN_PREFIXname the name of the beanGENERATED_BEAN_NAME_SEPARATORorg.springframework.beans.factory.support.BeanDefinitionReaderUtils.generateBeanName(org.springframework.beans.factory.config.BeanDefinition,org.springframework.beans.factory.support.BeanDefinitionRegistry)org.springframework.beans.factory.support.DefaultBeanNameGeneratorname the potentially generated bean nameGENERATED_BEAN_NAME_SEPARATORBeans that are "overridden" (specified in a descendant factory with the same name) are only counted once.
lbf the bean factorylbf the bean factorybeanNamesForTypeIncludingAncestors(org.springframework.beans.factory.ListableBeanFactory,java.lang.Class)Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.
This version of beanNamesForTypeIncludingAncestors automatically
includes prototypes and FactoryBeans.
lbf the bean factorytype the type that beans must matchpublic static String[]beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type) {
Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
lbf the bean factoryincludeNonSingletons whether to include prototype or scoped beans too
or just singletons (also applies to FactoryBeans)allowEagerInit whether to initialize lazy-init singletons and
objects created by FactoryBeans (or by factory methods with a
"factory-bean" reference) for the type check. Note that FactoryBeans need to be
eagerly initialized to determine their type: So be aware that passing in "true"
for this flag will initialize FactoryBeans and "factory-bean" references.type the type that beans must matchDoes consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.
lbf the bean factorytype type of bean to matchorg.springframework.beans.BeansException if a bean could not be createdDoes consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
lbf the bean factorytype type of bean to matchincludeNonSingletons whether to include prototype or scoped beans too
or just singletons (also applies to FactoryBeans)allowEagerInit whether to initialize lazy-init singletons and
objects created by FactoryBeans (or by factory methods with a
"factory-bean" reference) for the type check. Note that FactoryBeans need to be
eagerly initialized to determine their type: So be aware that passing in "true"
for this flag will initialize FactoryBeans and "factory-bean" references.org.springframework.beans.BeansException if a bean could not be createdDoes consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.
This version of beanOfTypeIncludingAncestors automatically includes
prototypes and FactoryBeans.
lbf the bean factorytype type of bean to matchNoSuchBeanDefinitionException
if 0 or more than 1 beans of the given type were foundorg.springframework.beans.BeansException if the bean could not be createdthrow new NoSuchBeanDefinitionException(type, "expected single bean but found " + beansOfType.size());
Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
lbf the bean factorytype type of bean to matchincludeNonSingletons whether to include prototype or scoped beans too
or just singletons (also applies to FactoryBeans)allowEagerInit whether to initialize lazy-init singletons and
objects created by FactoryBeans (or by factory methods with a
"factory-bean" reference) for the type check. Note that FactoryBeans need to be
eagerly initialized to determine their type: So be aware that passing in "true"
for this flag will initialize FactoryBeans and "factory-bean" references.NoSuchBeanDefinitionException
if 0 or more than 1 beans of the given type were foundorg.springframework.beans.BeansException if the bean could not be createdMap beansOfType = beansOfTypeIncludingAncestors(lbf, type, includeNonSingletons, allowEagerInit);
throw new NoSuchBeanDefinitionException(type, "expected single bean but found " + beansOfType.size());
Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.
This version of beanOfType automatically includes
prototypes and FactoryBeans.
lbf the bean factorytype type of bean to matchNoSuchBeanDefinitionException
if 0 or more than 1 beans of the given type were foundorg.springframework.beans.BeansException if the bean could not be createdthrow new NoSuchBeanDefinitionException(type, "expected single bean but found " + beansOfType.size());
Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
lbf the bean factorytype type of bean to matchincludeNonSingletons whether to include prototype or scoped beans too
or just singletons (also applies to FactoryBeans)allowEagerInit whether to initialize lazy-init singletons and
objects created by FactoryBeans (or by factory methods with a
"factory-bean" reference) for the type check. Note that FactoryBeans need to be
eagerly initialized to determine their type: So be aware that passing in "true"
for this flag will initialize FactoryBeans and "factory-bean" references.NoSuchBeanDefinitionException
if 0 or more than 1 beans of the given type were foundorg.springframework.beans.BeansException if the bean could not be createdthrow new NoSuchBeanDefinitionException(type, "expected single bean but found " + beansOfType.size());