org.springframework.beans.factory.support

Class ChildBeanDefinition

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, BeanMetadataElement, BeanDefinition, AttributeAccessor


    public class ChildBeanDefinition
    extends AbstractBeanDefinition
    Bean definition for beans which inherit settings from their parent. Child bean definitions have a fixed dependency on a parent bean definition.

    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:
    GenericBeanDefinition, RootBeanDefinition, Serialized Form