public class

ChildBeanDefinition

extends AbstractBeanDefinition
java.lang.Object
   ↳ org.springframework.core.AttributeAccessorSupport
     ↳ org.springframework.beans.BeanMetadataAttributeAccessor
       ↳ org.springframework.beans.factory.support.AbstractBeanDefinition
         ↳ org.springframework.beans.factory.support.ChildBeanDefinition

Class Overview

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 setParentName(String) method. This effectively supersedes the ChildBeanDefinition class for most use cases.

Summary

[Expand]
Inherited Constants
From class org.springframework.beans.factory.support.AbstractBeanDefinition
From interface org.springframework.beans.factory.config.BeanDefinition
Public Constructors
ChildBeanDefinition(String parentName)
Create a new ChildBeanDefinition for the given parent, to be configured through its bean properties and configuration methods.
ChildBeanDefinition(String parentName, MutablePropertyValues pvs)
Create a new ChildBeanDefinition for the given parent.
ChildBeanDefinition(String parentName, ConstructorArgumentValues cargs, MutablePropertyValues pvs)
Create a new ChildBeanDefinition for the given parent.
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(ChildBeanDefinition original)
Create a new ChildBeanDefinition as deep copy of the given bean definition.
Public Methods
AbstractBeanDefinition cloneBeanDefinition()
Clone this bean definition.
boolean equals(Object other)
String getParentName()
int hashCode()
void setParentName(String parentName)
String toString()
void validate()
Validate this bean definition.
[Expand]
Inherited Methods
From class org.springframework.beans.factory.support.AbstractBeanDefinition
From class org.springframework.beans.BeanMetadataAttributeAccessor
From class org.springframework.core.AttributeAccessorSupport
From class java.lang.Object
From interface org.springframework.beans.BeanMetadataElement
From interface org.springframework.beans.factory.config.BeanDefinition
From interface org.springframework.core.AttributeAccessor

Public Constructors

public ChildBeanDefinition (String parentName)

Also: SpringBeans

Create 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

public ChildBeanDefinition (String parentName, MutablePropertyValues pvs)

Also: SpringBeans

Create a new ChildBeanDefinition for the given parent.

Parameters
parentName the name of the parent bean
pvs the additional property values of the child

public ChildBeanDefinition (String parentName, ConstructorArgumentValues cargs, MutablePropertyValues pvs)

Also: SpringBeans

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

public ChildBeanDefinition (String parentName, Class beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs)

Also: SpringBeans

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

public ChildBeanDefinition (String parentName, String beanClassName, ConstructorArgumentValues cargs, MutablePropertyValues pvs)

Also: SpringBeans

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

public ChildBeanDefinition (ChildBeanDefinition original)

Also: SpringBeans

Create a new ChildBeanDefinition as deep copy of the given bean definition.

Parameters
original the original bean definition to copy from

Public Methods

public AbstractBeanDefinition cloneBeanDefinition ()

Also: SpringBeans

Clone this bean definition. To be implemented by concrete subclasses.

Returns
  • the cloned bean definition object

public boolean equals (Object other)

Also: SpringBeans

public String getParentName ()

Also: SpringBeans

public int hashCode ()

Also: SpringBeans

public void setParentName (String parentName)

Also: SpringBeans

public String toString ()

Also: SpringBeans

public void validate ()

Also: SpringBeans

Validate this bean definition.