Class RegisteredBean
java.lang.Object
org.springframework.beans.factory.support.RegisteredBean
A
RegisteredBean
represents a bean that has been registered with a
BeanFactory
, but has not necessarily been instantiated. It provides
access to the bean factory that contains the bean as well as the bean name.
In the case of inner-beans, the bean name may have been generated.- Since:
- 6.0
- Author:
- Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
Return the user-defined class of the bean.Return the bean factory containing the bean.Return the name of the bean.Return theResolvableType
of the bean.Return the merged bean definition of the bean.Return the parent of this instance ornull
if not an inner-bean.boolean
Return if the bean name is generated.boolean
Return if this instance is for an inner-bean.static RegisteredBean
of
(ConfigurableListableBeanFactory beanFactory, String beanName) Create a newRegisteredBean
instance for a regular bean.static RegisteredBean
ofInnerBean
(RegisteredBean parent, String innerBeanName, BeanDefinition innerBeanDefinition) Create a newRegisteredBean
instance for an inner-bean.static RegisteredBean
ofInnerBean
(RegisteredBean parent, BeanDefinition innerBeanDefinition) Create a newRegisteredBean
instance for an inner-bean.static RegisteredBean
ofInnerBean
(RegisteredBean parent, BeanDefinitionHolder innerBean) Create a newRegisteredBean
instance for an inner-bean.resolveAutowiredArgument
(DependencyDescriptor descriptor, TypeConverter typeConverter, Set<String> autowiredBeans) Resolve an autowired argument.Resolve the constructor or factory method to use for this bean.toString()
-
Method Details
-
of
Create a newRegisteredBean
instance for a regular bean.- Parameters:
beanFactory
- the source bean factorybeanName
- the bean name- Returns:
- a new
RegisteredBean
instance
-
ofInnerBean
Create a newRegisteredBean
instance for an inner-bean.- Parameters:
parent
- the parent of the inner-beaninnerBean
- aBeanDefinitionHolder
for the inner bean- Returns:
- a new
RegisteredBean
instance
-
ofInnerBean
Create a newRegisteredBean
instance for an inner-bean.- Parameters:
parent
- the parent of the inner-beaninnerBeanDefinition
- the inner-bean definition- Returns:
- a new
RegisteredBean
instance
-
ofInnerBean
public static RegisteredBean ofInnerBean(RegisteredBean parent, @Nullable String innerBeanName, BeanDefinition innerBeanDefinition) Create a newRegisteredBean
instance for an inner-bean.- Parameters:
parent
- the parent of the inner-beaninnerBeanName
- the name of the inner bean ornull
to generate a nameinnerBeanDefinition
- the inner-bean definition- Returns:
- a new
RegisteredBean
instance
-
getBeanName
Return the name of the bean.- Returns:
- the beanName the bean name
-
isGeneratedBeanName
public boolean isGeneratedBeanName()Return if the bean name is generated.- Returns:
true
if the name was generated
-
getBeanFactory
Return the bean factory containing the bean.- Returns:
- the bean factory
-
getBeanClass
Return the user-defined class of the bean.- Returns:
- the bean class
-
getBeanType
Return theResolvableType
of the bean.- Returns:
- the bean type
-
getMergedBeanDefinition
Return the merged bean definition of the bean.- Returns:
- the merged bean definition
- See Also:
-
isInnerBean
public boolean isInnerBean()Return if this instance is for an inner-bean.- Returns:
- if an inner-bean
-
getParent
Return the parent of this instance ornull
if not an inner-bean.- Returns:
- the parent
-
resolveConstructorOrFactoryMethod
Resolve the constructor or factory method to use for this bean.- Returns:
- the
Constructor
orMethod
-
resolveAutowiredArgument
@Nullable public Object resolveAutowiredArgument(DependencyDescriptor descriptor, TypeConverter typeConverter, Set<String> autowiredBeans) Resolve an autowired argument.- Parameters:
descriptor
- the descriptor for the dependency (field/method/constructor)typeConverter
- the TypeConverter to use for populating arrays and collectionsautowiredBeans
- a Set that all names of autowired beans (used for resolving the given dependency) are supposed to be added to- Returns:
- the resolved object, or
null
if none found - Since:
- 6.0.9
-
toString
-