Class ChildBeanDefinition
- All Implemented Interfaces:
- Serializable,- Cloneable,- BeanMetadataElement,- BeanDefinition,- AttributeAccessor
A child bean definition will inherit constructor argument values, property values and method overrides from the parent, with the option to add new values. If init method, destroy method and/or static factory method are specified, they will override the corresponding parent settings. The remaining settings will always be taken from the child definition: depends on, autowire mode, dependency check, singleton, lazy init.
NOTE: Since Spring 2.5, the preferred way to register bean
 definitions programmatically is the GenericBeanDefinition class,
 which allows to dynamically define parent dependencies through the
 GenericBeanDefinition.setParentName(java.lang.String) method. This effectively
 supersedes the ChildBeanDefinition class for most use cases.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from class org.springframework.beans.factory.support.AbstractBeanDefinitionAUTOWIRE_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, ORDER_ATTRIBUTE, PREFERRED_CONSTRUCTORS_ATTRIBUTE, SCOPE_DEFAULTFields inherited from interface org.springframework.beans.factory.config.BeanDefinitionROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON
- 
Constructor SummaryConstructorsConstructorDescriptionChildBeanDefinition(String parentName) Create a new ChildBeanDefinition for the given parent, to be configured through its bean properties and configuration methods.ChildBeanDefinition(String parentName, Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values.ChildBeanDefinition(String parentName, String beanClassName, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values.ChildBeanDefinition(String parentName, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent.ChildBeanDefinition(String parentName, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent.ChildBeanDefinition(ChildBeanDefinition original) Create a new ChildBeanDefinition as deep copy of the given bean definition.
- 
Method SummaryModifier and TypeMethodDescriptionClone this bean definition.booleanReturn the name of the parent definition of this bean definition, if any.inthashCode()voidsetParentName(@Nullable String parentName) Set the name of the parent definition of this bean definition, if any.toString()voidvalidate()Validate this bean definition.Methods inherited from class org.springframework.beans.factory.support.AbstractBeanDefinitionaddQualifier, applyDefaults, clone, copyQualifiersFrom, getAutowireMode, getBeanClass, getBeanClassName, getConstructorArgumentValues, getDependencyCheck, getDependsOn, getDescription, getDestroyMethodName, getDestroyMethodNames, getFactoryBeanName, getFactoryMethodName, getInitMethodName, getInitMethodNames, getInstanceSupplier, getLazyInit, getMethodOverrides, getOriginatingBeanDefinition, getPropertyValues, getQualifier, getQualifiers, getResolvableType, getResolvedAutowireMode, getResource, getResourceDescription, getRole, getScope, hasBeanClass, hasConstructorArgumentValues, hasMethodOverrides, hasPropertyValues, hasQualifier, isAbstract, isAutowireCandidate, isBackgroundInit, isDefaultCandidate, isEnforceDestroyMethod, isEnforceInitMethod, isFallback, isLazyInit, isLenientConstructorResolution, isNonPublicAccessAllowed, isPrimary, isPrototype, isSingleton, isSynthetic, overrideFrom, prepareMethodOverride, prepareMethodOverrides, resolveBeanClass, setAbstract, setAutowireCandidate, setAutowireMode, setBackgroundInit, setBeanClass, setBeanClassName, setConstructorArgumentValues, setDefaultCandidate, setDependencyCheck, setDependsOn, setDescription, setDestroyMethodName, setDestroyMethodNames, setEnforceDestroyMethod, setEnforceInitMethod, setFactoryBeanName, setFactoryMethodName, setFallback, setInitMethodName, setInitMethodNames, setInstanceSupplier, setLazyInit, setLenientConstructorResolution, setMethodOverrides, setNonPublicAccessAllowed, setOriginatingBeanDefinition, setPrimary, setPropertyValues, setResource, setResourceDescription, setRole, setScope, setSyntheticMethods inherited from class org.springframework.beans.BeanMetadataAttributeAccessoraddMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSourceMethods inherited from class org.springframework.core.AttributeAccessorSupportattributeNames, computeAttribute, copyAttributesFrom, hasAttributeMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.AttributeAccessorattributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttributeMethods inherited from interface org.springframework.beans.BeanMetadataElementgetSource
- 
Constructor Details- 
ChildBeanDefinitionCreate a new ChildBeanDefinition for the given parent, to be configured through its bean properties and configuration methods.- Parameters:
- parentName- the name of the parent bean
- See Also:
 
- 
ChildBeanDefinitionCreate a new ChildBeanDefinition for the given parent.- Parameters:
- parentName- the name of the parent bean
- pvs- the additional property values of the child
 
- 
ChildBeanDefinitionpublic ChildBeanDefinition(String parentName, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent.- Parameters:
- parentName- the name of the parent bean
- cargs- the constructor argument values to apply
- pvs- the additional property values of the child
 
- 
ChildBeanDefinitionpublic ChildBeanDefinition(String parentName, Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values.- Parameters:
- parentName- the name of the parent bean
- beanClass- the class of the bean to instantiate
- cargs- the constructor argument values to apply
- pvs- the property values to apply
 
- 
ChildBeanDefinitionpublic ChildBeanDefinition(String parentName, String beanClassName, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values. Takes a bean class name to avoid eager loading of the bean class.- Parameters:
- parentName- the name of the parent bean
- beanClassName- the name of the class to instantiate
- cargs- the constructor argument values to apply
- pvs- the property values to apply
 
- 
ChildBeanDefinitionCreate a new ChildBeanDefinition as deep copy of the given bean definition.- Parameters:
- original- the original bean definition to copy from
 
 
- 
- 
Method Details- 
setParentNameDescription copied from interface:BeanDefinitionSet the name of the parent definition of this bean definition, if any.
- 
getParentNameDescription copied from interface:BeanDefinitionReturn the name of the parent definition of this bean definition, if any.
- 
validateDescription copied from class:AbstractBeanDefinitionValidate this bean definition.- Overrides:
- validatein class- AbstractBeanDefinition
- Throws:
- BeanDefinitionValidationException- in case of validation failure
 
- 
cloneBeanDefinitionDescription copied from class:AbstractBeanDefinitionClone this bean definition. To be implemented by concrete subclasses.- Specified by:
- cloneBeanDefinitionin class- AbstractBeanDefinition
- Returns:
- the cloned bean definition object
 
- 
equals- Overrides:
- equalsin class- AbstractBeanDefinition
 
- 
hashCodepublic int hashCode()- Overrides:
- hashCodein class- AbstractBeanDefinition
 
- 
toString- Overrides:
- toStringin class- AbstractBeanDefinition
 
 
-