public class RootBeanDefinition extends AbstractBeanDefinition
GenericBeanDefinitions
.
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 GenericBeanDefinition
class.
GenericBeanDefinition has the advantage that it allows to dynamically define
parent dependencies, not 'hard-coding' the role as a root bean definition.
GenericBeanDefinition
,
ChildBeanDefinition
,
Serialized FormModifier and Type | Field and Description |
---|---|
(package private) boolean |
allowCaching |
(package private) java.lang.Boolean |
beforeInstantiationResolved
Package-visible field that indicates a before-instantiation post-processor having kicked in
|
(package private) java.lang.Object |
constructorArgumentLock |
(package private) boolean |
constructorArgumentsResolved
Package-visible field that marks the constructor arguments as resolved
|
private BeanDefinitionHolder |
decoratedDefinition |
private java.util.Map<java.lang.reflect.Member,java.lang.Boolean> |
externallyManagedConfigMembers |
private java.util.Map<java.lang.String,java.lang.Boolean> |
externallyManagedDestroyMethods |
private java.util.Map<java.lang.String,java.lang.Boolean> |
externallyManagedInitMethods |
(package private) boolean |
isFactoryMethodUnique |
(package private) boolean |
postProcessed
Package-visible field that indicates MergedBeanDefinitionPostProcessor having been applied
|
(package private) java.lang.Object |
postProcessingLock |
(package private) java.lang.Object[] |
preparedConstructorArguments
Package-visible field for caching partly prepared constructor arguments
|
(package private) java.lang.Object[] |
resolvedConstructorArguments
Package-visible field for caching fully resolved constructor arguments
|
(package private) java.lang.Object |
resolvedConstructorOrFactoryMethod
Package-visible field for caching the resolved constructor or factory method
|
private java.lang.Class<?> |
targetType |
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
ROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON
Constructor and Description |
---|
RootBeanDefinition()
Create a new RootBeanDefinition, to be configured through its bean
properties and configuration methods.
|
RootBeanDefinition(BeanDefinition original)
Create a new RootBeanDefinition as deep copy of the given
bean definition.
|
RootBeanDefinition(java.lang.Class<?> beanClass)
Create a new RootBeanDefinition for a singleton.
|
RootBeanDefinition(java.lang.Class<?> beanClass,
ConstructorArgumentValues cargs,
MutablePropertyValues pvs)
Create a new RootBeanDefinition for a singleton,
providing constructor arguments and property values.
|
RootBeanDefinition(java.lang.Class<?> beanClass,
int autowireMode,
boolean dependencyCheck)
Create a new RootBeanDefinition for a singleton,
using the given autowire mode.
|
RootBeanDefinition(java.lang.Class beanClass,
boolean singleton)
Deprecated.
since Spring 2.5, in favor of
AbstractBeanDefinition.setScope(java.lang.String) |
RootBeanDefinition(java.lang.Class beanClass,
int autowireMode)
Deprecated.
as of Spring 3.0, in favor of
AbstractBeanDefinition.setAutowireMode(int) usage |
RootBeanDefinition(java.lang.Class beanClass,
MutablePropertyValues pvs)
Deprecated.
as of Spring 3.0, in favor of
AbstractBeanDefinition.getPropertyValues() usage |
RootBeanDefinition(java.lang.Class beanClass,
MutablePropertyValues pvs,
boolean singleton)
Deprecated.
since Spring 2.5, in favor of
AbstractBeanDefinition.setScope(java.lang.String) |
RootBeanDefinition(RootBeanDefinition original)
Create a new RootBeanDefinition as deep copy of the given
bean definition.
|
RootBeanDefinition(java.lang.String beanClassName)
Create a new RootBeanDefinition for a singleton,
providing constructor arguments and property values.
|
RootBeanDefinition(java.lang.String beanClassName,
ConstructorArgumentValues cargs,
MutablePropertyValues pvs)
Create a new RootBeanDefinition for a singleton,
providing constructor arguments and property values.
|
Modifier and Type | Method and Description |
---|---|
RootBeanDefinition |
cloneBeanDefinition()
Clone this bean definition.
|
boolean |
equals(java.lang.Object other) |
BeanDefinitionHolder |
getDecoratedDefinition() |
java.lang.String |
getParentName()
Return the name of the parent definition of this bean definition, if any.
|
java.lang.reflect.Method |
getResolvedFactoryMethod()
Return the resolved factory method as a Java Method object, if available.
|
java.lang.Class<?> |
getTargetType()
Return the target type of this bean definition, if known
(either specified in advance or resolved on first instantiation).
|
boolean |
isExternallyManagedConfigMember(java.lang.reflect.Member configMember) |
boolean |
isExternallyManagedDestroyMethod(java.lang.String destroyMethod) |
boolean |
isExternallyManagedInitMethod(java.lang.String initMethod) |
boolean |
isFactoryMethod(java.lang.reflect.Method candidate)
Check whether the given candidate qualifies as a factory method.
|
void |
registerExternallyManagedConfigMember(java.lang.reflect.Member configMember) |
void |
registerExternallyManagedDestroyMethod(java.lang.String destroyMethod) |
void |
registerExternallyManagedInitMethod(java.lang.String initMethod) |
void |
setDecoratedDefinition(BeanDefinitionHolder decoratedDefinition) |
void |
setParentName(java.lang.String parentName)
Set the name of the parent definition of this bean definition, if any.
|
void |
setTargetType(java.lang.Class<?> targetType)
Specify the target type of this bean definition, if known in advance.
|
void |
setUniqueFactoryMethodName(java.lang.String name)
Specify a factory method name that refers to a non-overloaded method.
|
java.lang.String |
toString() |
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, 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, setSingleton, setSynthetic, validate
addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource
attributeNames, copyAttributesFrom, hasAttribute
finalize, getClass, notify, notifyAll, wait, wait, wait
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute
getSource
private final java.util.Map<java.lang.reflect.Member,java.lang.Boolean> externallyManagedConfigMembers
private final java.util.Map<java.lang.String,java.lang.Boolean> externallyManagedInitMethods
private final java.util.Map<java.lang.String,java.lang.Boolean> externallyManagedDestroyMethods
private BeanDefinitionHolder decoratedDefinition
boolean allowCaching
private volatile java.lang.Class<?> targetType
boolean isFactoryMethodUnique
final java.lang.Object constructorArgumentLock
java.lang.Object resolvedConstructorOrFactoryMethod
boolean constructorArgumentsResolved
java.lang.Object[] resolvedConstructorArguments
java.lang.Object[] preparedConstructorArguments
final java.lang.Object postProcessingLock
boolean postProcessed
volatile java.lang.Boolean beforeInstantiationResolved
public RootBeanDefinition()
AbstractBeanDefinition.setBeanClass(java.lang.Class<?>)
,
AbstractBeanDefinition.setBeanClassName(java.lang.String)
,
AbstractBeanDefinition.setScope(java.lang.String)
,
AbstractBeanDefinition.setAutowireMode(int)
,
AbstractBeanDefinition.setDependencyCheck(int)
,
AbstractBeanDefinition.setConstructorArgumentValues(org.springframework.beans.factory.config.ConstructorArgumentValues)
,
AbstractBeanDefinition.setPropertyValues(org.springframework.beans.MutablePropertyValues)
public RootBeanDefinition(java.lang.Class<?> beanClass)
beanClass
- the class of the bean to instantiate@Deprecated public RootBeanDefinition(java.lang.Class beanClass, boolean singleton)
AbstractBeanDefinition.setScope(java.lang.String)
beanClass
- the class of the bean to instantiatesingleton
- the singleton status of the bean@Deprecated public RootBeanDefinition(java.lang.Class beanClass, int autowireMode)
AbstractBeanDefinition.setAutowireMode(int)
usagebeanClass
- the class of the bean to instantiateautowireMode
- by name or type, using the constants in this interfacepublic RootBeanDefinition(java.lang.Class<?> beanClass, int autowireMode, boolean dependencyCheck)
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)@Deprecated public RootBeanDefinition(java.lang.Class beanClass, MutablePropertyValues pvs)
AbstractBeanDefinition.getPropertyValues()
usagebeanClass
- the class of the bean to instantiatepvs
- the property values to apply@Deprecated public RootBeanDefinition(java.lang.Class beanClass, MutablePropertyValues pvs, boolean singleton)
AbstractBeanDefinition.setScope(java.lang.String)
beanClass
- the class of the bean to instantiatepvs
- the property values to applysingleton
- the singleton status of the beanpublic RootBeanDefinition(java.lang.Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
beanClass
- the class of the bean to instantiatecargs
- the constructor argument values to applypvs
- the property values to applypublic RootBeanDefinition(java.lang.String beanClassName)
Takes a bean class name to avoid eager loading of the bean class.
beanClassName
- the name of the class to instantiatepublic RootBeanDefinition(java.lang.String beanClassName, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
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 applypublic RootBeanDefinition(RootBeanDefinition original)
original
- the original bean definition to copy fromRootBeanDefinition(BeanDefinition original)
original
- the original bean definition to copy frompublic java.lang.String getParentName()
BeanDefinition
public void setParentName(java.lang.String parentName)
BeanDefinition
public void setTargetType(java.lang.Class<?> targetType)
public java.lang.Class<?> getTargetType()
public void setUniqueFactoryMethodName(java.lang.String name)
public boolean isFactoryMethod(java.lang.reflect.Method candidate)
public java.lang.reflect.Method getResolvedFactoryMethod()
null
if not found or not resolved yetpublic void registerExternallyManagedConfigMember(java.lang.reflect.Member configMember)
public boolean isExternallyManagedConfigMember(java.lang.reflect.Member configMember)
public void registerExternallyManagedInitMethod(java.lang.String initMethod)
public boolean isExternallyManagedInitMethod(java.lang.String initMethod)
public void registerExternallyManagedDestroyMethod(java.lang.String destroyMethod)
public boolean isExternallyManagedDestroyMethod(java.lang.String destroyMethod)
public void setDecoratedDefinition(BeanDefinitionHolder decoratedDefinition)
public BeanDefinitionHolder getDecoratedDefinition()
public RootBeanDefinition cloneBeanDefinition()
AbstractBeanDefinition
cloneBeanDefinition
in class AbstractBeanDefinition
public boolean equals(java.lang.Object other)
equals
in class AbstractBeanDefinition
public java.lang.String toString()
toString
in class AbstractBeanDefinition