org.springframework.beans.factory.support
Class RootBeanDefinition

java.lang.Object
  extended by org.springframework.core.AttributeAccessorSupport
      extended by org.springframework.beans.BeanMetadataAttributeAccessor
          extended by org.springframework.beans.factory.support.AbstractBeanDefinition
              extended by org.springframework.beans.factory.support.RootBeanDefinition
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, BeanMetadataElement, BeanDefinition, AttributeAccessor

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

Author:
Rod Johnson, Juergen Hoeller
See Also:
GenericBeanDefinition, ChildBeanDefinition, Serialized Form

Field Summary
 
Fields inherited from class 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
 
Fields inherited from interface org.springframework.beans.factory.config.BeanDefinition
ROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON
 
Constructor Summary
RootBeanDefinition()
          Create a new RootBeanDefinition, to be configured through its bean properties and configuration methods.
RootBeanDefinition(java.lang.Class beanClass)
          Create a new RootBeanDefinition for a singleton.
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, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
          Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.
RootBeanDefinition(java.lang.Class beanClass, int autowireMode)
          Create a new RootBeanDefinition for a singleton, using the given autowire mode.
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, MutablePropertyValues pvs)
          Create a new RootBeanDefinition for a singleton, providing property values.
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, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
          Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.
 
Method Summary
 AbstractBeanDefinition cloneBeanDefinition()
          Clone this bean definition.
 boolean equals(java.lang.Object other)
           
 java.lang.String getParentName()
          Return the name of the parent definition of this bean definition, if any.
 boolean isExternallyManagedConfigMember(java.lang.reflect.Member configMember)
           
 boolean isExternallyManagedDestroyMethod(java.lang.String destroyMethod)
           
 boolean isExternallyManagedInitMethod(java.lang.String initMethod)
           
 void registerExternallyManagedConfigMember(java.lang.reflect.Member configMember)
           
 void registerExternallyManagedDestroyMethod(java.lang.String destroyMethod)
           
 void registerExternallyManagedInitMethod(java.lang.String initMethod)
           
 void setParentName(java.lang.String parentName)
          Set the name of the parent definition of this bean definition, if any.
 java.lang.String toString()
           
 
Methods inherited from class 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, 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, setMethodOverrides, setOriginatingBeanDefinition, setPrimary, setPropertyValues, setResource, setResourceDescription, setRole, setScope, setSingleton, setSynthetic, validate
 
Methods inherited from class org.springframework.beans.BeanMetadataAttributeAccessor
addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource
 
Methods inherited from class org.springframework.core.AttributeAccessorSupport
attributeNames, copyAttributesFrom, hasAttribute
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.core.AttributeAccessor
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute
 
Methods inherited from interface org.springframework.beans.BeanMetadataElement
getSource
 

Constructor Detail

RootBeanDefinition

public RootBeanDefinition()
Create a new RootBeanDefinition, to be configured through its bean properties and configuration methods.

See Also:
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)

RootBeanDefinition

public RootBeanDefinition(java.lang.Class beanClass)
Create a new RootBeanDefinition for a singleton.

Parameters:
beanClass - the class of the bean to instantiate

RootBeanDefinition

@Deprecated
public RootBeanDefinition(java.lang.Class beanClass,
                                     boolean singleton)
Deprecated. since Spring 2.5, in favor of AbstractBeanDefinition.setScope(java.lang.String)

Create a new RootBeanDefinition with the given singleton status.

Parameters:
beanClass - the class of the bean to instantiate
singleton - the singleton status of the bean

RootBeanDefinition

public RootBeanDefinition(java.lang.Class beanClass,
                          int autowireMode)
Create a new RootBeanDefinition for a singleton, using the given autowire mode.

Parameters:
beanClass - the class of the bean to instantiate
autowireMode - by name or type, using the constants in this interface

RootBeanDefinition

public RootBeanDefinition(java.lang.Class beanClass,
                          int autowireMode,
                          boolean dependencyCheck)
Create a new RootBeanDefinition for a singleton, using the given autowire mode.

Parameters:
beanClass - the class of the bean to instantiate
autowireMode - by name or type, using the constants in this interface
dependencyCheck - whether to perform a dependency check for objects (not applicable to autowiring a constructor, thus ignored there)

RootBeanDefinition

public RootBeanDefinition(java.lang.Class beanClass,
                          MutablePropertyValues pvs)
Create a new RootBeanDefinition for a singleton, providing property values.

Parameters:
beanClass - the class of the bean to instantiate
pvs - the property values to apply

RootBeanDefinition

@Deprecated
public RootBeanDefinition(java.lang.Class beanClass,
                                     MutablePropertyValues pvs,
                                     boolean singleton)
Deprecated. since Spring 2.5, in favor of AbstractBeanDefinition.setScope(java.lang.String)

Create a new RootBeanDefinition with the given singleton status, providing property values.

Parameters:
beanClass - the class of the bean to instantiate
pvs - the property values to apply
singleton - the singleton status of the bean

RootBeanDefinition

public RootBeanDefinition(java.lang.Class beanClass,
                          ConstructorArgumentValues cargs,
                          MutablePropertyValues pvs)
Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.

Parameters:
beanClass - the class of the bean to instantiate
cargs - the constructor argument values to apply
pvs - the property values to apply

RootBeanDefinition

public RootBeanDefinition(java.lang.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.

Parameters:
beanClassName - the name of the class to instantiate
cargs - the constructor argument values to apply
pvs - the property values to apply

RootBeanDefinition

public RootBeanDefinition(RootBeanDefinition original)
Create a new RootBeanDefinition as deep copy of the given bean definition.

Parameters:
original - the original bean definition to copy from
Method Detail

getParentName

public java.lang.String getParentName()
Description copied from interface: BeanDefinition
Return the name of the parent definition of this bean definition, if any.


setParentName

public void setParentName(java.lang.String parentName)
Description copied from interface: BeanDefinition
Set the name of the parent definition of this bean definition, if any.


registerExternallyManagedConfigMember

public void registerExternallyManagedConfigMember(java.lang.reflect.Member configMember)

isExternallyManagedConfigMember

public boolean isExternallyManagedConfigMember(java.lang.reflect.Member configMember)

registerExternallyManagedInitMethod

public void registerExternallyManagedInitMethod(java.lang.String initMethod)

isExternallyManagedInitMethod

public boolean isExternallyManagedInitMethod(java.lang.String initMethod)

registerExternallyManagedDestroyMethod

public void registerExternallyManagedDestroyMethod(java.lang.String destroyMethod)

isExternallyManagedDestroyMethod

public boolean isExternallyManagedDestroyMethod(java.lang.String destroyMethod)

cloneBeanDefinition

public AbstractBeanDefinition cloneBeanDefinition()
Description copied from class: AbstractBeanDefinition
Clone this bean definition. To be implemented by concrete subclasses.

Specified by:
cloneBeanDefinition in class AbstractBeanDefinition
Returns:
the cloned bean definition object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class AbstractBeanDefinition

toString

public java.lang.String toString()
Overrides:
toString in class AbstractBeanDefinition