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 method. This effectively
supersedes the ChildBeanDefinition class for most use cases.
GenericBeanDefinition, RootBeanDefinition
| Modifier and Type | Field and Description |
|---|---|
| private String |
| Access | Constructor and Description |
|---|---|
| public | ChildBeanDefinition(String
the name of the parent bean parentName)Create a new ChildBeanDefinition for the given parent, to be configured through its bean properties and configuration methods. |
| public | ChildBeanDefinition(String
the name of the parent bean parentName, MutablePropertyValues the additional property values of the child pvs)Create a new ChildBeanDefinition for the given parent. |
| public | ChildBeanDefinition(String
the name of the parent bean parentName, ConstructorArgumentValues the constructor argument values to apply cargs, MutablePropertyValues the additional property values of the child pvs)Create a new ChildBeanDefinition for the given parent. |
| public | ChildBeanDefinition(String
the name of the parent bean parentName, Class<?> the class of the bean to instantiate beanClass, ConstructorArgumentValues the constructor argument values to apply cargs, MutablePropertyValues the property values to apply pvs)Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values. |
| public | ChildBeanDefinition(String
the name of the parent bean parentName, String the name of the class to instantiate beanClassName, ConstructorArgumentValues the constructor argument values to apply cargs, MutablePropertyValues the property values to apply pvs)Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values. |
| public | ChildBeanDefinition(ChildBeanDefinition
the original bean definition to copy from original)Create a new ChildBeanDefinition as deep copy of the given bean definition. |
| parentName | back to summary |
|---|---|
| private String parentName
| |
| ChildBeanDefinition | back to summary |
|---|---|
| public ChildBeanDefinition(String parentName) Create a new ChildBeanDefinition for the given parent, to be configured through its bean properties and configuration methods.
| |
| ChildBeanDefinition | back to summary |
|---|---|
| public ChildBeanDefinition(String parentName, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent.
| |
| ChildBeanDefinition | back to summary |
|---|---|
| public ChildBeanDefinition(String parentName, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent.
| |
| ChildBeanDefinition | back to summary |
|---|---|
| public ChildBeanDefinition(String parentName, Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) Create a new ChildBeanDefinition for the given parent, providing constructor arguments and property values.
| |
| ChildBeanDefinition | back to summary |
|---|---|
| public 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.
| |
| ChildBeanDefinition | back to summary |
|---|---|
| public ChildBeanDefinition(ChildBeanDefinition original) Create a new ChildBeanDefinition as deep copy of the given bean definition.
| |
| cloneBeanDefinition | back to summary |
|---|---|
| public AbstractBeanDefinition cloneBeanDefinition() Implements abstract org. Doc from org. Clone this bean definition. To be implemented by concrete subclasses.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides org. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getParentName | back to summary |
|---|---|
| public String getParentName() Implements org. Doc from org. Return the name of the parent definition of this bean definition, if any. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| setParentName | back to summary |
|---|---|
| public void setParentName(String parentName) Implements org. Doc from org. Set the name of the parent definition of this bean definition, if any.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| validate | back to summary |
|---|---|
| public void validate() throws BeanDefinitionValidationException Overrides org. Doc from org. Validate this bean definition.
| |