Top Description Fields Constructors Methods
org.springframework.beans.factory

public abstract Class BeanFactoryUtils

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.util.ArrayList, .Arrays, .LinkedHashMap, .List, .Map, java.util.concurrent.ConcurrentHashMap, org.springframework.beans.BeansException, org.springframework.core.ResolvableType, org.springframework.lang.Nullable, org.springframework.util.Assert, .StringUtils

Convenience methods operating on bean factories, in particular on the 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).

Authors
Rod Johnson, Juergen Hoeller, Chris Beams
Since
04.07.2003

Field Summary

Modifier and TypeField and Description
public static final String
GENERATED_BEAN_NAME_SEPARATOR

Separator for generated bean names.

private static final Map<String, String>
transformedBeanNameCache

Cache from name with factory bean prefix to stripped name without dereference.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String[]

Returns:

the array of matching bean names, or an empty array if none
beanNamesForAnnotationIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<? extends Annotation>
the type of annotation to look for
annotationType
)

Get all bean names whose Class has the supplied Annotation type, including those defined in ancestor factories, without creating any bean instances yet.

public static String[]

Returns:

the array of matching bean names, or an empty array if none
beanNamesForTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
ResolvableType
the type that beans must match (as a ResolvableType)
type
)

Get all bean names for the given type, including those defined in ancestor factories.

public static String[]

Returns:

the array of matching bean names, or an empty array if none
beanNamesForTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
ResolvableType
the type that beans must match (as a ResolvableType)
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
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.
allowEagerInit
)

Get all bean names for the given type, including those defined in ancestor factories.

public static String[]

Returns:

the array of matching bean names, or an empty array if none
beanNamesForTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<?>
the type that beans must match (as a Class)
type
)

Get all bean names for the given type, including those defined in ancestor factories.

public static String[]

Returns:

the array of matching bean names, or an empty array if none
beanNamesForTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<?>
the type that beans must match
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
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.
allowEagerInit
)

Get all bean names for the given type, including those defined in ancestor factories.

public static String[]

Returns:

the array of matching bean names, or an empty array if none
beanNamesIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
)

Return all bean names in the factory, including ancestor factories.

public static <T> T

Returns:

the matching bean instance
beanOfType
(ListableBeanFactory
the bean factory
lbf
,
Class<T>
type of bean to match
type
)

Return a single bean of the given type or subtypes, not looking in ancestor factories.

public static <T> T

Returns:

the matching bean instance
beanOfType
(ListableBeanFactory
the bean factory
lbf
,
Class<T>
type of bean to match
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
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.
allowEagerInit
)

Return a single bean of the given type or subtypes, not looking in ancestor factories.

public static <T> T

Returns:

the matching bean instance
beanOfTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<T>
type of bean to match
type
)

Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.

public static <T> T

Returns:

the matching bean instance
beanOfTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<T>
type of bean to match
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
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.
allowEagerInit
)

Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.

public static <T> Map<String, T>

Returns:

the Map of matching bean instances, or an empty Map if none
beansOfTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<T>
type of bean to match
type
)

Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.

public static <T> Map<String, T>

Returns:

the Map of matching bean instances, or an empty Map if none
beansOfTypeIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
,
Class<T>
type of bean to match
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
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.
allowEagerInit
)

Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.

public static int

Returns:

count of beans including those defined in ancestor factories
countBeansIncludingAncestors
(ListableBeanFactory
the bean factory
lbf
)

Count all beans in any hierarchy in which this factory participates.

public static boolean

Returns:

whether the given name is a factory dereference
isFactoryDereference
(String
the name of the bean
name
)

Return whether the given name is a factory dereference (beginning with the factory dereference prefix).

public static boolean

Returns:

whether the given name is a generated bean name
isGeneratedBeanName
(String
the name of the bean
name
)

Return whether the given name is a bean name which has been generated by the default naming strategy (containing a "#..." part).

private static String[]

Returns:

the merged result (possibly the local result as-is)
mergeNamesWithParent
(String[]
the local bean name result
result
,
String[]
the parent bean name result (possibly empty)
parentResult
,
HierarchicalBeanFactory
the local bean factory
hbf
)

Merge the given bean names result with the given parent result.

public static String

Returns:

the raw bean name
originalBeanName
(String
the potentially generated bean name
name
)

Extract the "raw" bean name from the given (potentially generated) bean name, excluding any "#..." suffixes which might have been added for uniqueness.

public static String

Returns:

the transformed name
transformedBeanName
(String
the name of the bean
name
)

Return the actual bean name, stripping out the factory dereference prefix (if any, also stripping repeated factory prefixes if found).

private static <T> T

Returns:

the unique bean instance
uniqueBean
(Class<T>
type of bean to match
type
,
Map<String, T>
all matching beans found
matchingBeans
)

Extract a unique bean for the given type from the given Map of matching beans.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GENERATED_BEAN_NAME_SEPARATORback to summary
public static final String GENERATED_BEAN_NAME_SEPARATOR

Separator for generated bean names. If a class name or parent name is not unique, "#1", "#2" etc will be appended, until the name becomes unique.

transformedBeanNameCacheback to summary
private static final Map<String, String> transformedBeanNameCache

Cache from name with factory bean prefix to stripped name without dereference.

Since
5.1
See Also
BeanFactory#FACTORY_BEAN_PREFIX

Constructor Detail

BeanFactoryUtilsback to summary
public BeanFactoryUtils()

Method Detail

beanNamesForAnnotationIncludingAncestorsback to summary
public static String[] beanNamesForAnnotationIncludingAncestors(ListableBeanFactory lbf, Class<? extends Annotation> annotationType)

Get all bean names whose Class has the supplied Annotation type, including those defined in ancestor factories, without creating any bean instances yet. Will return unique names in case of overridden bean definitions.

Parameters
lbf:ListableBeanFactory

the bean factory

annotationType:Class<? extends Annotation>

the type of annotation to look for

Returns:String[]

the array of matching bean names, or an empty array if none

Since
5.0
See Also
ListableBeanFactory#getBeanNamesForAnnotation(Class)
beanNamesForTypeIncludingAncestorsback to summary
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, ResolvableType type)

Get all bean names for the given type, including those defined in ancestor factories. Will return unique names in case of overridden bean definitions.

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.

Parameters
lbf:ListableBeanFactory

the bean factory

type:ResolvableType

the type that beans must match (as a ResolvableType)

Returns:String[]

the array of matching bean names, or an empty array if none

Since
4.2
See Also
ListableBeanFactory#getBeanNamesForType(ResolvableType)
beanNamesForTypeIncludingAncestorsback to summary
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)

Get all bean names for the given type, including those defined in ancestor factories. Will return unique names in case of overridden bean definitions.

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).

Parameters
lbf:ListableBeanFactory

the bean factory

type:ResolvableType

the type that beans must match (as a ResolvableType)

includeNonSingletons:boolean

whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)

allowEagerInit:boolean

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.

Returns:String[]

the array of matching bean names, or an empty array if none

Since
5.2
See Also
ListableBeanFactory#getBeanNamesForType(ResolvableType, boolean, boolean)
beanNamesForTypeIncludingAncestorsback to summary
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class<?> type)

Get all bean names for the given type, including those defined in ancestor factories. Will return unique names in case of overridden bean definitions.

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.

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<?>

the type that beans must match (as a Class)

Returns:String[]

the array of matching bean names, or an empty array if none

See Also
ListableBeanFactory#getBeanNamesForType(Class)
beanNamesForTypeIncludingAncestorsback to summary
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)

Get all bean names for the given type, including those defined in ancestor factories. Will return unique names in case of overridden bean definitions.

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).

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<?>

the type that beans must match

includeNonSingletons:boolean

whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)

allowEagerInit:boolean

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.

Returns:String[]

the array of matching bean names, or an empty array if none

See Also
ListableBeanFactory#getBeanNamesForType(Class, boolean, boolean)
beanNamesIncludingAncestorsback to summary
public static String[] beanNamesIncludingAncestors(ListableBeanFactory lbf)

Return all bean names in the factory, including ancestor factories.

Parameters
lbf:ListableBeanFactory

the bean factory

Returns:String[]

the array of matching bean names, or an empty array if none

See Also
beanNamesForTypeIncludingAncestors
beanOfTypeback to summary
public static <T> T beanOfType(ListableBeanFactory lbf, Class<T> type) throws BeansException

Return a single bean of the given type or subtypes, not looking in ancestor factories. Useful convenience method when we expect a single bean and don't care about the bean name.

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.

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<T>

type of bean to match

Returns:T

the matching bean instance

Exceptions
BeansException:
if the bean could not be created
NoSuchBeanDefinitionException:
if no bean of the given type was found
NoUniqueBeanDefinitionException:
if more than one bean of the given type was found
See Also
ListableBeanFactory#getBeansOfType(Class)
beanOfTypeback to summary
public static <T> T beanOfType(ListableBeanFactory lbf, Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException

Return a single bean of the given type or subtypes, not looking in ancestor factories. Useful convenience method when we expect a single bean and don't care about the bean name.

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).

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<T>

type of bean to match

includeNonSingletons:boolean

whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)

allowEagerInit:boolean

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.

Returns:T

the matching bean instance

Exceptions
BeansException:
if the bean could not be created
NoSuchBeanDefinitionException:
if no bean of the given type was found
NoUniqueBeanDefinitionException:
if more than one bean of the given type was found
See Also
ListableBeanFactory#getBeansOfType(Class, boolean, boolean)
beanOfTypeIncludingAncestorsback to summary
public static <T> T beanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class<T> type) throws BeansException

Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. Useful convenience method when we expect a single bean and don't care about the bean name.

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 beanOfTypeIncludingAncestors automatically includes prototypes and FactoryBeans.

Note: Beans of the same name will take precedence at the 'lowest' factory level, i.e. such beans will be returned from the lowest factory that they are being found in, hiding corresponding beans in ancestor factories. This feature allows for 'replacing' beans by explicitly choosing the same bean name in a child factory; the bean in the ancestor factory won't be visible then, not even for by-type lookups.

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<T>

type of bean to match

Returns:T

the matching bean instance

Exceptions
BeansException:
if the bean could not be created
NoSuchBeanDefinitionException:
if no bean of the given type was found
NoUniqueBeanDefinitionException:
if more than one bean of the given type was found
See Also
beansOfTypeIncludingAncestors(ListableBeanFactory, Class)
beanOfTypeIncludingAncestorsback to summary
public static <T> T beanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException

Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. Useful convenience method when we expect a single bean and don't care about the bean name.

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).

Note: Beans of the same name will take precedence at the 'lowest' factory level, i.e. such beans will be returned from the lowest factory that they are being found in, hiding corresponding beans in ancestor factories. This feature allows for 'replacing' beans by explicitly choosing the same bean name in a child factory; the bean in the ancestor factory won't be visible then, not even for by-type lookups.

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<T>

type of bean to match

includeNonSingletons:boolean

whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)

allowEagerInit:boolean

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.

Returns:T

the matching bean instance

Exceptions
BeansException:
if the bean could not be created
NoSuchBeanDefinitionException:
if no bean of the given type was found
NoUniqueBeanDefinitionException:
if more than one bean of the given type was found
See Also
beansOfTypeIncludingAncestors(ListableBeanFactory, Class, boolean, boolean)
beansOfTypeIncludingAncestorsback to summary
public static <T> Map<String, T> beansOfTypeIncludingAncestors(ListableBeanFactory lbf, Class<T> type) throws BeansException

Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. The returned Map will only contain beans of this type.

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.

Note: Beans of the same name will take precedence at the 'lowest' factory level, i.e. such beans will be returned from the lowest factory that they are being found in, hiding corresponding beans in ancestor factories. This feature allows for 'replacing' beans by explicitly choosing the same bean name in a child factory; the bean in the ancestor factory won't be visible then, not even for by-type lookups.

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<T>

type of bean to match

Returns:Map<String, T>

the Map of matching bean instances, or an empty Map if none

Exceptions
BeansException:
if a bean could not be created
See Also
ListableBeanFactory#getBeansOfType(Class)
beansOfTypeIncludingAncestorsback to summary
public static <T> Map<String, T> beansOfTypeIncludingAncestors(ListableBeanFactory lbf, Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException

Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. The returned Map will only contain beans of this 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).

Note: Beans of the same name will take precedence at the 'lowest' factory level, i.e. such beans will be returned from the lowest factory that they are being found in, hiding corresponding beans in ancestor factories. This feature allows for 'replacing' beans by explicitly choosing the same bean name in a child factory; the bean in the ancestor factory won't be visible then, not even for by-type lookups.

Parameters
lbf:ListableBeanFactory

the bean factory

type:Class<T>

type of bean to match

includeNonSingletons:boolean

whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)

allowEagerInit:boolean

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.

Returns:Map<String, T>

the Map of matching bean instances, or an empty Map if none

Exceptions
BeansException:
if a bean could not be created
See Also
ListableBeanFactory#getBeansOfType(Class, boolean, boolean)
countBeansIncludingAncestorsback to summary
public static int countBeansIncludingAncestors(ListableBeanFactory lbf)

Count all beans in any hierarchy in which this factory participates. Includes counts of ancestor bean factories.

Beans that are "overridden" (specified in a descendant factory with the same name) are only counted once.

Parameters
lbf:ListableBeanFactory

the bean factory

Returns:int

count of beans including those defined in ancestor factories

See Also
beanNamesIncludingAncestors
isFactoryDereferenceback to summary
public static boolean isFactoryDereference(String name)

Return whether the given name is a factory dereference (beginning with the factory dereference prefix).

Parameters
name:String

the name of the bean

Returns:boolean

whether the given name is a factory dereference

See Also
BeanFactory#FACTORY_BEAN_PREFIX
isGeneratedBeanNameback to summary
public static boolean isGeneratedBeanName(String name)

Return whether the given name is a bean name which has been generated by the default naming strategy (containing a "#..." part).

Parameters
name:String

the name of the bean

Returns:boolean

whether the given name is a generated bean name

See Also
GENERATED_BEAN_NAME_SEPARATOR, org.springframework.beans.factory.support.BeanDefinitionReaderUtils#generateBeanName, org.springframework.beans.factory.support.DefaultBeanNameGenerator
mergeNamesWithParentback to summary
private static String[] mergeNamesWithParent(String[] result, String[] parentResult, HierarchicalBeanFactory hbf)

Merge the given bean names result with the given parent result.

Parameters
result:String[]

the local bean name result

parentResult:String[]

the parent bean name result (possibly empty)

hbf:HierarchicalBeanFactory

the local bean factory

Returns:String[]

the merged result (possibly the local result as-is)

Since
4.3.15
originalBeanNameback to summary
public static String originalBeanName(String name)

Extract the "raw" bean name from the given (potentially generated) bean name, excluding any "#..." suffixes which might have been added for uniqueness.

Parameters
name:String

the potentially generated bean name

Returns:String

the raw bean name

See Also
GENERATED_BEAN_NAME_SEPARATOR
transformedBeanNameback to summary
public static String transformedBeanName(String name)

Return the actual bean name, stripping out the factory dereference prefix (if any, also stripping repeated factory prefixes if found).

Parameters
name:String

the name of the bean

Returns:String

the transformed name

See Also
BeanFactory#FACTORY_BEAN_PREFIX
uniqueBeanback to summary
private static <T> T uniqueBean(Class<T> type, Map<String, T> matchingBeans)

Extract a unique bean for the given type from the given Map of matching beans.

Parameters
type:Class<T>

type of bean to match

matchingBeans:Map<String, T>

all matching beans found

Returns:T

the unique bean instance

Exceptions
NoSuchBeanDefinitionException:
if no bean of the given type was found
NoUniqueBeanDefinitionException:
if more than one bean of the given type was found