类 RootBeanDefinition
- java.lang.Object
- org.springframework.core.AttributeAccessorSupport
- org.springframework.beans.BeanMetadataAttributeAccessor
- org.springframework.beans.factory.support.AbstractBeanDefinition
- org.springframework.beans.factory.support.RootBeanDefinition
public class RootBeanDefinition extends AbstractBeanDefinition
A root bean definition represents the merged bean definition that backs a specific bean in a Spring BeanFactory at runtime. It might have been created from multiple original bean definitions that inherit from each other, typically registered asGenericBeanDefinitions. A root bean definition is essentially the 'unified' bean definition view at runtime.Root bean definitions may also be used for registering individual bean definitions in the configuration phase. However, since Spring 2.5, the preferred way to register bean definitions programmatically is the
GenericBeanDefinitionclass. GenericBeanDefinition has the advantage that it allows to dynamically define parent dependencies, not 'hard-coding' the role as a root bean definition.- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
GenericBeanDefinition,ChildBeanDefinition, 序列化表格
字段概要
从类继承的字段 org.springframework.beans.factory.support.AbstractBeanDefinition
AUTOWIRE_AUTODETECT, AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_CONSTRUCTOR, AUTOWIRE_NO, DEPENDENCY_CHECK_ALL, DEPENDENCY_CHECK_NONE, DEPENDENCY_CHECK_OBJECTS, DEPENDENCY_CHECK_SIMPLE, INFER_METHOD, SCOPE_DEFAULT
从接口继承的字段 org.springframework.beans.factory.config.BeanDefinition
ROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON
构造器概要
构造器 构造器 说明 RootBeanDefinition()Create a new RootBeanDefinition, to be configured through its bean properties and configuration methods.RootBeanDefinition(Class<?> beanClass)Create a new RootBeanDefinition for a singleton.RootBeanDefinition(Class<?> beanClass, int autowireMode, boolean dependencyCheck)Create a new RootBeanDefinition for a singleton, using the given autowire mode.RootBeanDefinition(Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs)Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.RootBeanDefinition(String beanClassName)Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.RootBeanDefinition(String beanClassName, ConstructorArgumentValues cargs, MutablePropertyValues pvs)Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.RootBeanDefinition(RootBeanDefinition original)Create a new RootBeanDefinition as deep copy of the given bean definition.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 RootBeanDefinitioncloneBeanDefinition()Clone this bean definition.booleanequals(Object other)BeanDefinitionHoldergetDecoratedDefinition()Return the target definition that is being decorated by this bean definition, if any.StringgetParentName()Return the name of the parent definition of this bean definition, if any.AnnotatedElementgetQualifiedElement()Return theAnnotatedElementdefining qualifiers, if any.MethodgetResolvedFactoryMethod()Return the resolved factory method as a Java Method object, if available.Class<?>getTargetType()Return the target type of this bean definition, if known (either specified in advance or resolved on first instantiation).booleanisExternallyManagedConfigMember(Member configMember)booleanisExternallyManagedDestroyMethod(String destroyMethod)booleanisExternallyManagedInitMethod(String initMethod)booleanisFactoryMethod(Method candidate)Check whether the given candidate qualifies as a factory method.voidregisterExternallyManagedConfigMember(Member configMember)voidregisterExternallyManagedDestroyMethod(String destroyMethod)voidregisterExternallyManagedInitMethod(String initMethod)voidsetDecoratedDefinition(BeanDefinitionHolder decoratedDefinition)Register a target definition that is being decorated by this bean definition.voidsetParentName(String parentName)Set the name of the parent definition of this bean definition, if any.voidsetQualifiedElement(AnnotatedElement qualifiedElement)Specify theAnnotatedElementdefining qualifiers, to be used instead of the target class or factory method.voidsetTargetType(Class<?> targetType)Specify the target type of this bean definition, if known in advance.voidsetTargetType(ResolvableType targetType)Specify a generics-containing target type of this bean definition, if known in advance.voidsetUniqueFactoryMethodName(String name)Specify a factory method name that refers to a non-overloaded method.StringtoString()从类继承的方法 org.springframework.beans.factory.support.AbstractBeanDefinition
addQualifier, applyDefaults, clone, copyQualifiersFrom, getAutowireMode, getBeanClass, getBeanClassName, getConstructorArgumentValues, getDependencyCheck, getDependsOn, getDescription, getDestroyMethodName, getFactoryBeanName, getFactoryMethodName, getInitMethodName, getMethodOverrides, getOriginatingBeanDefinition, getPropertyValues, getQualifier, getQualifiers, getResolvedAutowireMode, getResource, getResourceDescription, getRole, getScope, hasBeanClass, hasConstructorArgumentValues, hashCode, hasQualifier, isAbstract, isAutowireCandidate, isEnforceDestroyMethod, isEnforceInitMethod, isLazyInit, isLenientConstructorResolution, isNonPublicAccessAllowed, isPrimary, isPrototype, isSingleton, isSynthetic, overrideFrom, prepareMethodOverride, prepareMethodOverrides, resolveBeanClass, setAbstract, setAutowireCandidate, setAutowireMode, setBeanClass, setBeanClassName, setConstructorArgumentValues, setDependencyCheck, setDependsOn, setDescription, setDestroyMethodName, setEnforceDestroyMethod, setEnforceInitMethod, setFactoryBeanName, setFactoryMethodName, setInitMethodName, setLazyInit, setLenientConstructorResolution, setMethodOverrides, setNonPublicAccessAllowed, setOriginatingBeanDefinition, setPrimary, setPropertyValues, setResource, setResourceDescription, setRole, setScope, setSynthetic, validate
从类继承的方法 org.springframework.beans.BeanMetadataAttributeAccessor
addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource
从类继承的方法 org.springframework.core.AttributeAccessorSupport
attributeNames, copyAttributesFrom, hasAttribute
从接口继承的方法 org.springframework.core.AttributeAccessor
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute
从接口继承的方法 org.springframework.beans.BeanMetadataElement
getSource
构造器详细资料
RootBeanDefinition
public RootBeanDefinition()
Create a new RootBeanDefinition, to be configured through its bean properties and configuration methods.- 另请参阅:
AbstractBeanDefinition.setBeanClass(java.lang.Class<?>),AbstractBeanDefinition.setScope(java.lang.String),AbstractBeanDefinition.setConstructorArgumentValues(org.springframework.beans.factory.config.ConstructorArgumentValues),AbstractBeanDefinition.setPropertyValues(org.springframework.beans.MutablePropertyValues)
RootBeanDefinition
public RootBeanDefinition(Class<?> beanClass)
Create a new RootBeanDefinition for a singleton.- 参数:
beanClass- the class of the bean to instantiate- 另请参阅:
AbstractBeanDefinition.setBeanClass(java.lang.Class<?>)
RootBeanDefinition
public RootBeanDefinition(Class<?> beanClass, int autowireMode, boolean dependencyCheck)
Create a new RootBeanDefinition for a singleton, using the given autowire mode.- 参数:
beanClass- the class of the bean to instantiateautowireMode- by name or type, using the constants in this interfacedependencyCheck- whether to perform a dependency check for objects (not applicable to autowiring a constructor, thus ignored there)
RootBeanDefinition
public RootBeanDefinition(Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.- 参数:
beanClass- the class of the bean to instantiatecargs- the constructor argument values to applypvs- the property values to apply
RootBeanDefinition
public RootBeanDefinition(String beanClassName)
Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.Takes a bean class name to avoid eager loading of the bean class.
- 参数:
beanClassName- the name of the class to instantiate
RootBeanDefinition
public RootBeanDefinition(String beanClassName, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.Takes a bean class name to avoid eager loading of the bean class.
- 参数:
beanClassName- the name of the class to instantiatecargs- the constructor argument values to applypvs- the property values to apply
RootBeanDefinition
public RootBeanDefinition(RootBeanDefinition original)
Create a new RootBeanDefinition as deep copy of the given bean definition.- 参数:
original- the original bean definition to copy from
方法详细资料
getParentName
public String getParentName()
从接口复制的说明:BeanDefinitionReturn the name of the parent definition of this bean definition, if any.
setParentName
public void setParentName(String parentName)
从接口复制的说明:BeanDefinitionSet the name of the parent definition of this bean definition, if any.
setDecoratedDefinition
public void setDecoratedDefinition(BeanDefinitionHolder decoratedDefinition)
Register a target definition that is being decorated by this bean definition.
getDecoratedDefinition
public BeanDefinitionHolder getDecoratedDefinition()
Return the target definition that is being decorated by this bean definition, if any.
setQualifiedElement
public void setQualifiedElement(AnnotatedElement qualifiedElement)
Specify theAnnotatedElementdefining qualifiers, to be used instead of the target class or factory method.- 从以下版本开始:
- 4.3.3
- 另请参阅:
setTargetType(ResolvableType),getResolvedFactoryMethod()
getQualifiedElement
public AnnotatedElement getQualifiedElement()
Return theAnnotatedElementdefining qualifiers, if any. Otherwise, the factory method and target class will be checked.- 从以下版本开始:
- 4.3.3
setTargetType
public void setTargetType(ResolvableType targetType)
Specify a generics-containing target type of this bean definition, if known in advance.- 从以下版本开始:
- 4.3.3
setTargetType
public void setTargetType(Class<?> targetType)
Specify the target type of this bean definition, if known in advance.- 从以下版本开始:
- 3.2.2
getTargetType
public Class<?> getTargetType()
Return the target type of this bean definition, if known (either specified in advance or resolved on first instantiation).- 从以下版本开始:
- 3.2.2
setUniqueFactoryMethodName
public void setUniqueFactoryMethodName(String name)
Specify a factory method name that refers to a non-overloaded method.
isFactoryMethod
public boolean isFactoryMethod(Method candidate)
Check whether the given candidate qualifies as a factory method.
getResolvedFactoryMethod
public Method getResolvedFactoryMethod()
Return the resolved factory method as a Java Method object, if available.- 返回:
- the factory method, or
nullif not found or not resolved yet
registerExternallyManagedConfigMember
public void registerExternallyManagedConfigMember(Member configMember)
isExternallyManagedConfigMember
public boolean isExternallyManagedConfigMember(Member configMember)
registerExternallyManagedInitMethod
public void registerExternallyManagedInitMethod(String initMethod)
isExternallyManagedInitMethod
public boolean isExternallyManagedInitMethod(String initMethod)
registerExternallyManagedDestroyMethod
public void registerExternallyManagedDestroyMethod(String destroyMethod)
isExternallyManagedDestroyMethod
public boolean isExternallyManagedDestroyMethod(String destroyMethod)
cloneBeanDefinition
public RootBeanDefinition cloneBeanDefinition()
从类复制的说明:AbstractBeanDefinitionClone this bean definition. To be implemented by concrete subclasses.- 指定者:
cloneBeanDefinition在类中AbstractBeanDefinition- 返回:
- the cloned bean definition object
equals
public boolean equals(Object other)
- 覆盖:
equals在类中AbstractBeanDefinition
toString
public String toString()
- 覆盖:
toString在类中AbstractBeanDefinition