Top Description Fields Constructors Methods
org.springframework.beans.factory.support

public Class GenericBeanDefinition

extends AbstractBeanDefinition
Class Inheritance
Known Direct Subclasses
org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition
Annotations
@SuppressWarnings:serial
Imports
org.springframework.beans.factory.config.BeanDefinition, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils

GenericBeanDefinition is a one-stop shop for declarative bean definition purposes. Like all common bean definitions, it allows for specifying a class plus optionally constructor argument values and property values. Additionally, deriving from a parent bean definition can be flexibly configured through the "parentName" property.

In general, use this GenericBeanDefinition class for the purpose of registering declarative bean definitions (e.g. XML definitions which a bean post-processor might operate on, potentially even reconfiguring the parent name). Use RootBeanDefinition/ChildBeanDefinition where parent/child relationships happen to be pre-determined, and prefer RootBeanDefinition specifically for programmatic definitions derived from factory methods/suppliers.

Author
Juergen Hoeller
Since
2.5
See Also
setParentName, RootBeanDefinition, ChildBeanDefinition

Field Summary

Modifier and TypeField and Description
private String
Inherited from org.springframework.beans.factory.support.AbstractBeanDefinition:
AUTOWIRE_AUTODETECTAUTOWIRE_BY_NAMEAUTOWIRE_BY_TYPEAUTOWIRE_CONSTRUCTORAUTOWIRE_NODEPENDENCY_CHECK_ALLDEPENDENCY_CHECK_NONEDEPENDENCY_CHECK_OBJECTSDEPENDENCY_CHECK_SIMPLEINFER_METHODORDER_ATTRIBUTEPREFERRED_CONSTRUCTORS_ATTRIBUTESCOPE_DEFAULT

Constructor Summary

AccessConstructor and Description
public
GenericBeanDefinition()

Create a new GenericBeanDefinition, to be configured through its bean properties and configuration methods.

public
GenericBeanDefinition(BeanDefinition
the original bean definition to copy from
original
)

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

Method Summary

Modifier and TypeMethod and Description
public AbstractBeanDefinition
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides org.springframework.beans.factory.support.AbstractBeanDefinition.equals.

Indicates whether some other object is "equal to" this one.

public String
getParentName()

Implements org.springframework.beans.factory.config.BeanDefinition.getParentName.

Return the name of the parent definition of this bean definition, if any.

public void
setParentName(String parentName)

Implements org.springframework.beans.factory.config.BeanDefinition.setParentName.

Set the name of the parent definition of this bean definition, if any.

public String
toString()

Overrides org.springframework.beans.factory.support.AbstractBeanDefinition.toString.

Returns a string representation of the object.

Inherited from org.springframework.beans.factory.support.AbstractBeanDefinition:
addQualifierapplyDefaultsclonecopyQualifiersFromgetAutowireModegetBeanClassgetBeanClassNamegetConstructorArgumentValuesgetDependencyCheckgetDependsOngetDescriptiongetDestroyMethodNamegetDestroyMethodNamesgetFactoryBeanNamegetFactoryMethodNamegetInitMethodNamegetInitMethodNamesgetInstanceSuppliergetLazyInitgetMethodOverridesgetOriginatingBeanDefinitiongetPropertyValuesgetQualifiergetQualifiersgetResolvableTypegetResolvedAutowireModegetResourcegetResourceDescriptiongetRolegetScopehasBeanClasshasConstructorArgumentValueshashCodehasMethodOverrideshasPropertyValueshasQualifierisAbstractisAutowireCandidateisEnforceDestroyMethodisEnforceInitMethodisLazyInitisLenientConstructorResolutionisNonPublicAccessAllowedisPrimaryisPrototypeisSingletonisSyntheticoverrideFromprepareMethodOverrideprepareMethodOverridesresolveBeanClasssetAbstractsetAutowireCandidatesetAutowireModesetBeanClasssetBeanClassNamesetConstructorArgumentValuessetDependencyChecksetDependsOnsetDescriptionsetDestroyMethodNamesetDestroyMethodNamessetEnforceDestroyMethodsetEnforceInitMethodsetFactoryBeanNamesetFactoryMethodNamesetInitMethodNamesetInitMethodNamessetInstanceSuppliersetLazyInitsetLenientConstructorResolutionsetMethodOverridessetNonPublicAccessAllowedsetOriginatingBeanDefinitionsetPrimarysetPropertyValuessetResourcesetResourceDescriptionsetRolesetScopesetSyntheticvalidate

Field Detail

parentNameback to summary
private String parentName
Annotations
@Nullable

Constructor Detail

GenericBeanDefinitionback to summary
public GenericBeanDefinition()

Create a new GenericBeanDefinition, to be configured through its bean properties and configuration methods.

See Also
setBeanClass, setScope, setConstructorArgumentValues, setPropertyValues
GenericBeanDefinitionback to summary
public GenericBeanDefinition(BeanDefinition original)

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

Parameters
original:BeanDefinition

the original bean definition to copy from

Method Detail

cloneBeanDefinitionback to summary
public AbstractBeanDefinition cloneBeanDefinition()

Implements abstract org.springframework.beans.factory.support.AbstractBeanDefinition.cloneBeanDefinition.

Doc from org.springframework.beans.factory.support.AbstractBeanDefinition.cloneBeanDefinition.

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

Returns:AbstractBeanDefinition

the cloned bean definition object

Annotations
@Override
equalsback to summary
public boolean equals(Object other)

Overrides org.springframework.beans.factory.support.AbstractBeanDefinition.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

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.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getParentNameback to summary
public String getParentName()

Implements org.springframework.beans.factory.config.BeanDefinition.getParentName.

Doc from org.springframework.beans.factory.config.BeanDefinition.getParentName.

Return the name of the parent definition of this bean definition, if any.

Annotations
@Override
@Nullable
setParentNameback to summary
public void setParentName(String parentName)

Implements org.springframework.beans.factory.config.BeanDefinition.setParentName.

Doc from org.springframework.beans.factory.config.BeanDefinition.setParentName.

Set the name of the parent definition of this bean definition, if any.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.springframework.beans.factory.support.AbstractBeanDefinition.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override