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, Stephane Nicoll, Juergen Hoeller
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDescriptor for how a bean should be instantiated. -
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 theResolvableTypeof the bean.Return the merged bean definition of the bean.Return the parent of this instance ornullif not an inner-bean.booleanReturn if the bean name is generated.booleanReturn if this instance is for an inner-bean.static RegisteredBeanof(ConfigurableListableBeanFactory beanFactory, String beanName) Create a newRegisteredBeaninstance for a regular bean.static RegisteredBeanofInnerBean(RegisteredBean parent, String innerBeanName, BeanDefinition innerBeanDefinition) Create a newRegisteredBeaninstance for an inner-bean.static RegisteredBeanofInnerBean(RegisteredBean parent, BeanDefinition innerBeanDefinition) Create a newRegisteredBeaninstance for an inner-bean.static RegisteredBeanofInnerBean(RegisteredBean parent, BeanDefinitionHolder innerBean) Create a newRegisteredBeaninstance for an inner-bean.resolveAutowiredArgument(DependencyDescriptor descriptor, TypeConverter typeConverter, Set<String> autowiredBeanNames) Resolve an autowired argument.Deprecated.Resolve the descriptor to use to instantiate this bean.toString()
-
Method Details
-
of
Create a newRegisteredBeaninstance for a regular bean.- Parameters:
beanFactory- the source bean factorybeanName- the bean name- Returns:
- a new
RegisteredBeaninstance
-
ofInnerBean
Create a newRegisteredBeaninstance for an inner-bean.- Parameters:
parent- the parent of the inner-beaninnerBean- aBeanDefinitionHolderfor the inner bean- Returns:
- a new
RegisteredBeaninstance
-
ofInnerBean
Create a newRegisteredBeaninstance for an inner-bean.- Parameters:
parent- the parent of the inner-beaninnerBeanDefinition- the inner-bean definition- Returns:
- a new
RegisteredBeaninstance
-
ofInnerBean
public static RegisteredBean ofInnerBean(RegisteredBean parent, @Nullable String innerBeanName, BeanDefinition innerBeanDefinition) Create a newRegisteredBeaninstance for an inner-bean.- Parameters:
parent- the parent of the inner-beaninnerBeanName- the name of the inner bean ornullto generate a nameinnerBeanDefinition- the inner-bean definition- Returns:
- a new
RegisteredBeaninstance
-
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:
trueif 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 theResolvableTypeof 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 ornullif not an inner-bean.- Returns:
- the parent
-
resolveConstructorOrFactoryMethod
Deprecated.in favor ofresolveInstantiationDescriptor()Resolve the constructor or factory method to use for this bean.- Returns:
- the
ConstructororMethod
-
resolveInstantiationDescriptor
Resolve the descriptor to use to instantiate this bean. It defines theConstructororMethodto use as well as additional metadata.- Since:
- 6.1.7
-
resolveAutowiredArgument
@Nullable public Object resolveAutowiredArgument(DependencyDescriptor descriptor, TypeConverter typeConverter, Set<String> autowiredBeanNames) Resolve an autowired argument.- Parameters:
descriptor- the descriptor for the dependency (field/method/constructor)typeConverter- the TypeConverter to use for populating arrays and collectionsautowiredBeanNames- 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
nullif none found - Since:
- 6.0.9
-
toString
-
resolveInstantiationDescriptor()