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

public abstract Class AbstractBeanDefinition

extends BeanMetadataAttributeAccessor
implements BeanDefinition, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, org.springframework.beans.factory.config.BeanDefinition, org.springframework.beans.BeanMetadataElement, org.springframework.core.AttributeAccessor
Known Direct Subclasses
org.springframework.beans.factory.support.RootBeanDefinition, org.springframework.beans.factory.support.ChildBeanDefinition, org.springframework.beans.factory.support.GenericBeanDefinition
Annotations
@SuppressWarnings:serial
Imports
java.lang.reflect.Constructor, java.util.Arrays, .LinkedHashMap, .LinkedHashSet, .Map, .Set, java.util.function.Supplier, org.springframework.beans.BeanMetadataAttributeAccessor, .MutablePropertyValues, org.springframework.beans.factory.config.AutowireCapableBeanFactory, .BeanDefinition, .ConstructorArgumentValues, org.springframework.core.ResolvableType, org.springframework.core.io.DescriptiveResource, .Resource, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .ObjectUtils, .StringUtils

Base class for concrete, full-fledged BeanDefinition classes, factoring out common properties of GenericBeanDefinition, RootBeanDefinition, and ChildBeanDefinition.

The autowire constants match the ones defined in the org.springframework.beans.factory.config.AutowireCapableBeanFactory interface.

Authors
Rod Johnson, Juergen Hoeller, Rob Harrop, Mark Fisher, Sebastien Deleuze
See Also
GenericBeanDefinition, RootBeanDefinition, ChildBeanDefinition

Field Summary

Modifier and TypeField and Description
private boolean
public static final int
AUTOWIRE_AUTODETECT

Deprecated as of Spring 3.0: If you are using mixed autowiring strategies, use annotation-based autowiring for clearer demarcation of autowiring needs.
Constant that indicates determining an appropriate autowire strategy through introspection of the bean class.
public static final int
AUTOWIRE_BY_NAME

Constant that indicates autowiring bean properties by name.

public static final int
AUTOWIRE_BY_TYPE

Constant that indicates autowiring bean properties by type.

public static final int
AUTOWIRE_CONSTRUCTOR

Constant that indicates autowiring a constructor.

public static final int
AUTOWIRE_NO

Constant that indicates no external autowiring at all.

private boolean
private int
private volatile Object
private ConstructorArgumentValues
public static final int
DEPENDENCY_CHECK_ALL

Constant that indicates dependency checking for all properties (object references as well as "simple" properties).

public static final int
DEPENDENCY_CHECK_NONE

Constant that indicates no dependency check at all.

public static final int
DEPENDENCY_CHECK_OBJECTS

Constant that indicates dependency checking for object references.

public static final int
DEPENDENCY_CHECK_SIMPLE

Constant that indicates dependency checking for "simple" properties.

private int
private String[]
private String
private String[]
private boolean
private boolean
private String
private String
public static final String
INFER_METHOD

Constant that indicates the container should attempt to infer the destroy method name for a bean as opposed to explicit specification of a method name.

private String[]
private Supplier<?>
private Boolean
private boolean
private MethodOverrides
private boolean
public static final String
ORDER_ATTRIBUTE

The name of an attribute that can be set on a org.springframework.beans.factory.config.BeanDefinition so that bean definitions can indicate the sort order for the targeted bean.

public static final String
PREFERRED_CONSTRUCTORS_ATTRIBUTE

The name of an attribute that can be set on a org.springframework.beans.factory.config.BeanDefinition so that bean definitions can indicate one or more preferred constructors.

private boolean
private MutablePropertyValues
private final Map<String, AutowireCandidateQualifier>
private Resource
private int
private String
public static final String
SCOPE_DEFAULT

Constant for the default scope name: "", equivalent to singleton status unless overridden from a parent bean definition (if applicable).

private boolean

Constructor Summary

AccessConstructor and Description
protected
AbstractBeanDefinition()

Create a new AbstractBeanDefinition with default settings.

protected
AbstractBeanDefinition(ConstructorArgumentValues cargs, MutablePropertyValues pvs)

Create a new AbstractBeanDefinition with the given constructor argument values and property values.

protected
AbstractBeanDefinition(BeanDefinition
the original bean definition to copy from
original
)

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

Method Summary

Modifier and TypeMethod and Description
public void
addQualifier(AutowireCandidateQualifier qualifier)

Register a qualifier to be used for autowire candidate resolution, keyed by the qualifier's type name.

public void
applyDefaults(BeanDefinitionDefaults
the default settings to apply
defaults
)

Apply the provided default values to this bean.

public Object
clone()

Overrides java.lang.Object.clone.

Public declaration of Object's clone() method.

public abstract AbstractBeanDefinition

Returns:

the cloned bean definition object
cloneBeanDefinition
()

Clone this bean definition.

public void
copyQualifiersFrom(AbstractBeanDefinition
the AbstractBeanDefinition to copy from
source
)

Copy the qualifiers from the supplied AbstractBeanDefinition to this bean definition.

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides org.springframework.core.AttributeAccessorSupport.equals.

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

private boolean
private boolean
public int
getAutowireMode()

Return the autowire mode as specified in the bean definition.

public Class<?>

Returns:

the resolved bean class (never null)
getBeanClass
()

Return the specified class of the bean definition (assuming it is resolved already).

public String
getBeanClassName()

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

Return the current bean class name of this bean definition.

public ConstructorArgumentValues
getConstructorArgumentValues()

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

Return constructor argument values for this bean (never null).

public int
getDependencyCheck()

Return the dependency check code.

public String[]
getDependsOn()

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

Return the bean names that this bean depends on.

public String
getDescription()

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

Return a human-readable description of this bean definition.

public String
getDestroyMethodName()

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

Return the name of the destroy method (the first one in case of multiple methods).

public String[]
getDestroyMethodNames()

Return the names of the destroy methods.

public String
public String
public String
getInitMethodName()

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

Return the name of the initializer method (the first one in case of multiple methods).

public String[]
getInitMethodNames()

Return the names of the initializer methods.

public Supplier<?>
getInstanceSupplier()

Return a callback for creating an instance of the bean, if any.

public Boolean

Returns:

the lazy-init flag if explicitly set, or null otherwise
getLazyInit
()

Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup.

public MethodOverrides
getMethodOverrides()

Return information about methods to be overridden by the IoC container.

public BeanDefinition
public MutablePropertyValues
getPropertyValues()

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

Return property values for this bean (never null).

public AutowireCandidateQualifier
getQualifier(String typeName)

Return the qualifier mapped to the provided type name.

public Set<AutowireCandidateQualifier>

Returns:

the Set of AutowireCandidateQualifier objects.
getQualifiers
()

Return all registered qualifiers.

public ResolvableType
getResolvableType()

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

Return a resolvable type for this bean definition.

public int
getResolvedAutowireMode()

Return the resolved autowire code, (resolving AUTOWIRE_AUTODETECT to AUTOWIRE_CONSTRUCTOR or AUTOWIRE_BY_TYPE).

public Resource
getResource()

Return the resource that this bean definition came from.

public String
getResourceDescription()

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

Return a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).

public int
getRole()

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

Return the role hint for this BeanDefinition.

public String
getScope()

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

Return the name of the target scope for the bean.

public boolean
hasBeanClass()

Return whether this definition specifies a bean class.

public boolean
hasConstructorArgumentValues()

Overrides default org.springframework.beans.factory.config.BeanDefinition.hasConstructorArgumentValues.

Return if there are constructor argument values defined for this bean.

public int
hashCode()

Overrides org.springframework.core.AttributeAccessorSupport.hashCode.

Returns a hash code value for this object.

public boolean
hasMethodOverrides()

Return if there are method overrides defined for this bean.

public boolean
hasPropertyValues()

Overrides default org.springframework.beans.factory.config.BeanDefinition.hasPropertyValues.

Return if there are property values defined for this bean.

public boolean
hasQualifier(String typeName)

Return whether this bean has the specified qualifier.

public boolean
isAbstract()

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

Return whether this bean is "abstract", i.e. not meant to be instantiated itself but rather just serving as parent for concrete child bean definitions.

public boolean
isAutowireCandidate()

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

Return whether this bean is a candidate for getting autowired into some other bean.

public boolean
isEnforceDestroyMethod()

Indicate whether the configured destroy method is the default.

public boolean
isEnforceInitMethod()

Indicate whether the configured initializer method is the default.

public boolean

Returns:

whether to apply lazy-init semantics (false by default)
isLazyInit
()

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

Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup.

public boolean
isLenientConstructorResolution()

Return whether to resolve constructors in lenient mode or in strict mode.

public boolean
isNonPublicAccessAllowed()

Return whether to allow access to non-public constructors and methods.

public boolean
isPrimary()

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

Return whether this bean is a primary autowire candidate.

public boolean
isPrototype()

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

Return whether this a Prototype, with an independent instance returned for each call.

public boolean
isSingleton()

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

Return whether this a Singleton, with a single shared instance returned from all calls.

public boolean
isSynthetic()

Return whether this bean definition is 'synthetic', that is, not defined by the application itself.

public void
overrideFrom(BeanDefinition other)

Override settings in this bean definition (presumably a copied parent from a parent-child inheritance relationship) from the given bean definition (presumably the child).

protected void
prepareMethodOverride(MethodOverride
the MethodOverride object to validate
mo
)

Validate and prepare the given method override.

public void
prepareMethodOverrides()

Validate and prepare the method overrides defined for this bean.

public Class<?>

Returns:

the resolved bean class
resolveBeanClass
(ClassLoader
the ClassLoader to use for resolving a (potential) class name
classLoader
)

Determine the class of the wrapped bean, resolving it from a specified class name if necessary.

public void
setAbstract(boolean abstractFlag)

Set if this bean is "abstract", i.e. not meant to be instantiated itself but rather just serving as parent for concrete child bean definitions.

public void
setAutowireCandidate(boolean autowireCandidate)

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

Set whether this bean is a candidate for getting autowired into some other bean.

public void
setAutowireMode(int
the autowire mode to set. Must be one of the constants defined in this class.
autowireMode
)

Set the autowire mode.

public void
setBeanClass(Class<?> beanClass)

Specify the class for this bean.

public void
setBeanClassName(String beanClassName)

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

Specify the bean class name of this bean definition.

public void
setConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues)

Specify constructor argument values for this bean.

public void
setDependencyCheck(int
the code to set. Must be one of the four constants defined in this class.
dependencyCheck
)

Set the dependency check code.

public void
setDependsOn(String... dependsOn)

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

Set the names of the beans that this bean depends on being initialized.

public void
setDescription(String description)

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

Set a human-readable description of this bean definition.

public void
setDestroyMethodName(String destroyMethodName)

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

Set the name of the destroy method.

public void
setDestroyMethodNames(String... destroyMethodNames)

Specify the names of multiple destroy methods.

public void
setEnforceDestroyMethod(boolean enforceDestroyMethod)

Specify whether the configured destroy method is the default.

public void
setEnforceInitMethod(boolean enforceInitMethod)

Specify whether the configured initializer method is the default.

public void
setFactoryBeanName(String factoryBeanName)

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

Specify the factory bean to use, if any.

public void
public void
setInitMethodName(String initMethodName)

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

Set the name of the initializer method.

public void
setInitMethodNames(String... initMethodNames)

Specify the names of multiple initializer methods.

public void
setInstanceSupplier(Supplier<?> instanceSupplier)

Specify a callback for creating an instance of the bean, as an alternative to a declaratively specified factory method.

public void
setLazyInit(boolean lazyInit)

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

Set whether this bean should be lazily initialized.

public void
setLenientConstructorResolution(boolean lenientConstructorResolution)

Specify whether to resolve constructors in lenient mode (true, which is the default) or to switch to strict resolution (throwing an exception in case of ambiguous constructors that all match when converting the arguments, whereas lenient mode would use the one with the 'closest' type matches).

public void
setMethodOverrides(MethodOverrides methodOverrides)

Specify method overrides for the bean, if any.

public void
setNonPublicAccessAllowed(boolean nonPublicAccessAllowed)

Specify whether to allow access to non-public constructors and methods, for the case of externalized metadata pointing to those.

public void
setOriginatingBeanDefinition(BeanDefinition originatingBd)

Set the originating (e.g. decorated) BeanDefinition, if any.

public void
setPrimary(boolean primary)

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

Set whether this bean is a primary autowire candidate.

public void
setPropertyValues(MutablePropertyValues propertyValues)

Specify property values for this bean, if any.

public void
setResource(Resource resource)

Set the resource that this bean definition came from (for the purpose of showing context in case of errors).

public void
setResourceDescription(String resourceDescription)

Set a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).

public void
setRole(int role)

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

Set the role hint for this BeanDefinition.

public void
setScope(String scope)

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

Set the name of the target scope for the bean.

public void
setSynthetic(boolean synthetic)

Set whether this bean definition is 'synthetic', that is, not defined by the application itself (for example, an infrastructure bean such as a helper for auto-proxying, created through <aop:config>).

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
validate()

Validate this bean definition.

Inherited from org.springframework.beans.BeanMetadataAttributeAccessor:
addMetadataAttributegetAttributegetMetadataAttributegetSourceremoveAttributesetAttributesetSource