类 AbstractBeanDefinition
- java.lang.Object
- org.springframework.core.AttributeAccessorSupport
- org.springframework.beans.BeanMetadataAttributeAccessor
- org.springframework.beans.factory.support.AbstractBeanDefinition
public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccessor implements BeanDefinition, Cloneable
Base class for concrete, full-fledgedBeanDefinition
classes, factoring out common properties ofGenericBeanDefinition
,RootBeanDefinition
, andChildBeanDefinition
.The autowire constants match the ones defined in the
AutowireCapableBeanFactory
interface.- 作者:
- Rod Johnson, Juergen Hoeller, Rob Harrop, Mark Fisher
- 另请参阅:
GenericBeanDefinition
,RootBeanDefinition
,ChildBeanDefinition
, 序列化表格
字段概要
字段 修饰符和类型 字段 说明 static int
AUTOWIRE_AUTODETECT
已过时。as of Spring 3.0: If you are using mixed autowiring strategies, use annotation-based autowiring for clearer demarcation of autowiring needs.static int
AUTOWIRE_BY_NAME
Constant that indicates autowiring bean properties by name.static int
AUTOWIRE_BY_TYPE
Constant that indicates autowiring bean properties by type.static int
AUTOWIRE_CONSTRUCTOR
Constant that indicates autowiring a constructor.static int
AUTOWIRE_NO
Constant that indicates no autowiring at all.static int
DEPENDENCY_CHECK_ALL
Constant that indicates dependency checking for all properties (object references as well as "simple" properties).static int
DEPENDENCY_CHECK_NONE
Constant that indicates no dependency check at all.static int
DEPENDENCY_CHECK_OBJECTS
Constant that indicates dependency checking for object references.static int
DEPENDENCY_CHECK_SIMPLE
Constant that indicates dependency checking for "simple" properties.static String
INFER_METHOD
Constant that indicates the container should attempt to infer thedestroy method name
for a bean as opposed to explicit specification of a method name.static String
SCOPE_DEFAULT
Constant for the default scope name:""
, equivalent to singleton status unless overridden from a parent bean definition (if applicable).从接口继承的字段 org.springframework.beans.factory.config.BeanDefinition
ROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON
构造器概要
构造器 限定符 构造器 说明 protected
AbstractBeanDefinition()
Create a new AbstractBeanDefinition with default settings.protected
AbstractBeanDefinition(BeanDefinition original)
Create a new AbstractBeanDefinition as a deep copy of the given bean definition.protected
AbstractBeanDefinition(ConstructorArgumentValues cargs, MutablePropertyValues pvs)
Create a new AbstractBeanDefinition with the given constructor argument values and property values.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 void
addQualifier(AutowireCandidateQualifier qualifier)
Register a qualifier to be used for autowire candidate resolution, keyed by the qualifier's type name.void
applyDefaults(BeanDefinitionDefaults defaults)
Apply the provided default values to this bean.Object
clone()
Public declaration of Object'sclone()
method.abstract AbstractBeanDefinition
cloneBeanDefinition()
Clone this bean definition.void
copyQualifiersFrom(AbstractBeanDefinition source)
Copy the qualifiers from the supplied AbstractBeanDefinition to this bean definition.boolean
equals(Object other)
int
getAutowireMode()
Return the autowire mode as specified in the bean definition.Class<?>
getBeanClass()
Return the class of the wrapped bean (assuming it is resolved already).String
getBeanClassName()
Return the current bean class name of this bean definition.ConstructorArgumentValues
getConstructorArgumentValues()
Return constructor argument values for this bean (nevernull
).int
getDependencyCheck()
Return the dependency check code.String[]
getDependsOn()
Return the bean names that this bean depends on.String
getDescription()
Return a human-readable description of this bean definition.String
getDestroyMethodName()
Return the name of the destroy method.String
getFactoryBeanName()
Return the factory bean name, if any.String
getFactoryMethodName()
Return a factory method, if any.String
getInitMethodName()
Return the name of the initializer method.MethodOverrides
getMethodOverrides()
Return information about methods to be overridden by the IoC container.BeanDefinition
getOriginatingBeanDefinition()
Return the originating BeanDefinition, ornull
if none.MutablePropertyValues
getPropertyValues()
Return property values for this bean (nevernull
).AutowireCandidateQualifier
getQualifier(String typeName)
Return the qualifier mapped to the provided type name.Set<AutowireCandidateQualifier>
getQualifiers()
Return all registered qualifiers.int
getResolvedAutowireMode()
Return the resolved autowire code, (resolving AUTOWIRE_AUTODETECT to AUTOWIRE_CONSTRUCTOR or AUTOWIRE_BY_TYPE).Resource
getResource()
Return the resource that this bean definition came from.String
getResourceDescription()
Return a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).int
getRole()
Return the role hint for thisBeanDefinition
.String
getScope()
Return the name of the target scope for the bean.boolean
hasBeanClass()
Return whether this definition specifies a bean class.boolean
hasConstructorArgumentValues()
Return if there are constructor argument values defined for this bean.int
hashCode()
boolean
hasQualifier(String typeName)
Return whether this bean has the specified qualifier.boolean
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.boolean
isAutowireCandidate()
Return whether this bean is a candidate for getting autowired into some other bean.boolean
isEnforceDestroyMethod()
Indicate whether the configured destroy method is the default.boolean
isEnforceInitMethod()
Indicate whether the configured initializer method is the default.boolean
isLazyInit()
Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup.boolean
isLenientConstructorResolution()
Return whether to resolve constructors in lenient mode or in strict mode.boolean
isNonPublicAccessAllowed()
Return whether to allow access to non-public constructors and methods.boolean
isPrimary()
Return whether this bean is a primary autowire candidate.boolean
isPrototype()
Return whether this a Prototype, with an independent instance returned for each call.boolean
isSingleton()
Return whether this a Singleton, with a single shared instance returned from all calls.boolean
isSynthetic()
Return whether this bean definition is 'synthetic', that is, not defined by the application itself.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 mo)
Validate and prepare the given method override.void
prepareMethodOverrides()
Validate and prepare the method overrides defined for this bean.Class<?>
resolveBeanClass(ClassLoader classLoader)
Determine the class of the wrapped bean, resolving it from a specified class name if necessary.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.void
setAutowireCandidate(boolean autowireCandidate)
Set whether this bean is a candidate for getting autowired into some other bean.void
setAutowireMode(int autowireMode)
Set the autowire mode.void
setBeanClass(Class<?> beanClass)
Specify the class for this bean.void
setBeanClassName(String beanClassName)
Specify the bean class name of this bean definition.void
setConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues)
Specify constructor argument values for this bean.void
setDependencyCheck(int dependencyCheck)
Set the dependency check code.void
setDependsOn(String... dependsOn)
Set the names of the beans that this bean depends on being initialized.void
setDescription(String description)
Set a human-readable description of this bean definition.void
setDestroyMethodName(String destroyMethodName)
Set the name of the destroy method.void
setEnforceDestroyMethod(boolean enforceDestroyMethod)
Specify whether or not the configured destroy method is the default.void
setEnforceInitMethod(boolean enforceInitMethod)
Specify whether or not the configured initializer method is the default.void
setFactoryBeanName(String factoryBeanName)
Specify the factory bean to use, if any.void
setFactoryMethodName(String factoryMethodName)
Specify a factory method, if any.void
setInitMethodName(String initMethodName)
Set the name of the initializer method.void
setLazyInit(boolean lazyInit)
Set whether this bean should be lazily initialized.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).void
setMethodOverrides(MethodOverrides methodOverrides)
Specify method overrides for the bean, if any.void
setNonPublicAccessAllowed(boolean nonPublicAccessAllowed)
Specify whether to allow access to non-public constructors and methods, for the case of externalized metadata pointing to those.void
setOriginatingBeanDefinition(BeanDefinition originatingBd)
Set the originating (e.g. decorated) BeanDefinition, if any.void
setPrimary(boolean primary)
Set whether this bean is a primary autowire candidate.void
setPropertyValues(MutablePropertyValues propertyValues)
Specify property values for this bean, if any.void
setResource(Resource resource)
Set the resource that this bean definition came from (for the purpose of showing context in case of errors).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).void
setRole(int role)
Set the role hint for thisBeanDefinition
.void
setScope(String scope)
Set the name of the target scope for the bean.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>
).String
toString()
void
validate()
Validate this bean definition.从类继承的方法 org.springframework.beans.BeanMetadataAttributeAccessor
addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource
从类继承的方法 org.springframework.core.AttributeAccessorSupport
attributeNames, copyAttributesFrom, hasAttribute
从接口继承的方法 org.springframework.core.AttributeAccessor
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute
从接口继承的方法 org.springframework.beans.factory.config.BeanDefinition
getParentName, setParentName
从接口继承的方法 org.springframework.beans.BeanMetadataElement
getSource
字段详细资料
SCOPE_DEFAULT
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).- 另请参阅:
- 常量字段值
AUTOWIRE_NO
public static final int AUTOWIRE_NO
Constant that indicates no autowiring at all.- 另请参阅:
setAutowireMode(int)
, 常量字段值
AUTOWIRE_BY_NAME
public static final int AUTOWIRE_BY_NAME
Constant that indicates autowiring bean properties by name.- 另请参阅:
setAutowireMode(int)
, 常量字段值
AUTOWIRE_BY_TYPE
public static final int AUTOWIRE_BY_TYPE
Constant that indicates autowiring bean properties by type.- 另请参阅:
setAutowireMode(int)
, 常量字段值
AUTOWIRE_CONSTRUCTOR
public static final int AUTOWIRE_CONSTRUCTOR
Constant that indicates autowiring a constructor.- 另请参阅:
setAutowireMode(int)
, 常量字段值
AUTOWIRE_AUTODETECT
@Deprecated public static final int AUTOWIRE_AUTODETECT
已过时。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.- 另请参阅:
setAutowireMode(int)
, 常量字段值
DEPENDENCY_CHECK_NONE
public static final int DEPENDENCY_CHECK_NONE
Constant that indicates no dependency check at all.- 另请参阅:
setDependencyCheck(int)
, 常量字段值
DEPENDENCY_CHECK_OBJECTS
public static final int DEPENDENCY_CHECK_OBJECTS
Constant that indicates dependency checking for object references.- 另请参阅:
setDependencyCheck(int)
, 常量字段值
DEPENDENCY_CHECK_SIMPLE
public static final int DEPENDENCY_CHECK_SIMPLE
Constant that indicates dependency checking for "simple" properties.
DEPENDENCY_CHECK_ALL
public static final int DEPENDENCY_CHECK_ALL
Constant that indicates dependency checking for all properties (object references as well as "simple" properties).- 另请参阅:
setDependencyCheck(int)
, 常量字段值
INFER_METHOD
public static final String INFER_METHOD
Constant that indicates the container should attempt to infer thedestroy method name
for a bean as opposed to explicit specification of a method name. The value "(inferred)" is specifically designed to include characters otherwise illegal in a method name, ensuring no possibility of collisions with legitimately named methods having the same name.Currently, the method names detected during destroy method inference are "close" and "shutdown", if present on the specific bean class.
- 另请参阅:
- 常量字段值
构造器详细资料
AbstractBeanDefinition
protected AbstractBeanDefinition()
Create a new AbstractBeanDefinition with default settings.
AbstractBeanDefinition
protected AbstractBeanDefinition(ConstructorArgumentValues cargs, MutablePropertyValues pvs)
Create a new AbstractBeanDefinition with the given constructor argument values and property values.
AbstractBeanDefinition
protected AbstractBeanDefinition(BeanDefinition original)
Create a new AbstractBeanDefinition as a deep copy of the given bean definition.- 参数:
original
- the original bean definition to copy from
方法详细资料
overrideFrom
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).- Will override beanClass if specified in the given bean definition.
- Will always take
abstract
,scope
,lazyInit
,autowireMode
,dependencyCheck
, anddependsOn
from the given bean definition. - Will add
constructorArgumentValues
,propertyValues
,methodOverrides
from the given bean definition to existing ones. - Will override
factoryBeanName
,factoryMethodName
,initMethodName
, anddestroyMethodName
if specified in the given bean definition.
applyDefaults
public void applyDefaults(BeanDefinitionDefaults defaults)
Apply the provided default values to this bean.- 参数:
defaults
- the default settings to apply- 从以下版本开始:
- 2.5
setBeanClassName
public void setBeanClassName(String beanClassName)
Specify the bean class name of this bean definition.
getBeanClassName
public String getBeanClassName()
Return the current bean class name of this bean definition.
setBeanClass
public void setBeanClass(Class<?> beanClass)
Specify the class for this bean.
getBeanClass
public Class<?> getBeanClass() throws IllegalStateException
Return the class of the wrapped bean (assuming it is resolved already).- 返回:
- the bean class (never
null
) - 抛出:
IllegalStateException
- if the bean definition does not define a bean class, or a specified bean class name has not been resolved into an actual Class yet- 另请参阅:
hasBeanClass()
,setBeanClass(Class)
,resolveBeanClass(ClassLoader)
hasBeanClass
public boolean hasBeanClass()
Return whether this definition specifies a bean class.
resolveBeanClass
public Class<?> resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException
Determine the class of the wrapped bean, resolving it from a specified class name if necessary. Will also reload a specified Class from its name when called with the bean class already resolved.- 参数:
classLoader
- the ClassLoader to use for resolving a (potential) class name- 返回:
- the resolved bean class
- 抛出:
ClassNotFoundException
- if the class name could be resolved
setScope
public void setScope(String scope)
Set the name of the target scope for the bean.The default is singleton status, although this is only applied once a bean definition becomes active in the containing factory. A bean definition may eventually inherit its scope from a parent bean definition. For this reason, the default scope name is an empty string (i.e.,
""
), with singleton status being assumed until a resolved scope is set.
getScope
public String getScope()
Return the name of the target scope for the bean.- 指定者:
getScope
在接口中BeanDefinition
isSingleton
public boolean isSingleton()
Return whether this a Singleton, with a single shared instance returned from all calls.- 指定者:
isSingleton
在接口中BeanDefinition
- 另请参阅:
BeanDefinition.SCOPE_SINGLETON
isPrototype
public boolean isPrototype()
Return whether this a Prototype, with an independent instance returned for each call.- 指定者:
isPrototype
在接口中BeanDefinition
- 另请参阅:
BeanDefinition.SCOPE_PROTOTYPE
setAbstract
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.Default is "false". Specify true to tell the bean factory to not try to instantiate that particular bean in any case.
isAbstract
public boolean 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.- 指定者:
isAbstract
在接口中BeanDefinition
setLazyInit
public void setLazyInit(boolean lazyInit)
Set whether this bean should be lazily initialized.If
false
, the bean will get instantiated on startup by bean factories that perform eager initialization of singletons.- 指定者:
setLazyInit
在接口中BeanDefinition
isLazyInit
public boolean isLazyInit()
Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup. Only applicable to a singleton bean.- 指定者:
isLazyInit
在接口中BeanDefinition
- 返回:
- whether to apply lazy-init semantics (
false
by default)
setAutowireMode
public void setAutowireMode(int autowireMode)
Set the autowire mode. This determines whether any automagical detection and setting of bean references will happen. Default is AUTOWIRE_NO which means there won't be convention-based autowiring by name or type (however, there may still be explicit annotation-driven autowiring).- 参数:
autowireMode
- the autowire mode to set. Must be one of the constants defined in this class.- 另请参阅:
AUTOWIRE_NO
,AUTOWIRE_BY_NAME
,AUTOWIRE_BY_TYPE
,AUTOWIRE_CONSTRUCTOR
,AUTOWIRE_AUTODETECT
getAutowireMode
public int getAutowireMode()
Return the autowire mode as specified in the bean definition.
getResolvedAutowireMode
public int getResolvedAutowireMode()
Return the resolved autowire code, (resolving AUTOWIRE_AUTODETECT to AUTOWIRE_CONSTRUCTOR or AUTOWIRE_BY_TYPE).
setDependencyCheck
public void setDependencyCheck(int dependencyCheck)
Set the dependency check code.- 参数:
dependencyCheck
- the code to set. Must be one of the four constants defined in this class.- 另请参阅:
DEPENDENCY_CHECK_NONE
,DEPENDENCY_CHECK_OBJECTS
,DEPENDENCY_CHECK_SIMPLE
,DEPENDENCY_CHECK_ALL
getDependencyCheck
public int getDependencyCheck()
Return the dependency check code.
setDependsOn
public void setDependsOn(String... dependsOn)
Set the names of the beans that this bean depends on being initialized. The bean factory will guarantee that these beans get initialized first.Note that dependencies are normally expressed through bean properties or constructor arguments. This property should just be necessary for other kinds of dependencies like statics (*ugh*) or database preparation on startup.
- 指定者:
setDependsOn
在接口中BeanDefinition
getDependsOn
public String[] getDependsOn()
Return the bean names that this bean depends on.- 指定者:
getDependsOn
在接口中BeanDefinition
setAutowireCandidate
public void setAutowireCandidate(boolean autowireCandidate)
Set whether this bean is a candidate for getting autowired into some other bean.Note that this flag is designed to only affect type-based autowiring. It does not affect explicit references by name, which will get resolved even if the specified bean is not marked as an autowire candidate. As a consequence, autowiring by name will nevertheless inject a bean if the name matches.
- 指定者:
setAutowireCandidate
在接口中BeanDefinition
- 另请参阅:
AUTOWIRE_BY_TYPE
,AUTOWIRE_BY_NAME
isAutowireCandidate
public boolean isAutowireCandidate()
Return whether this bean is a candidate for getting autowired into some other bean.- 指定者:
isAutowireCandidate
在接口中BeanDefinition
setPrimary
public void setPrimary(boolean primary)
Set whether this bean is a primary autowire candidate.If this value is
true
for exactly one bean among multiple matching candidates, it will serve as a tie-breaker.- 指定者:
setPrimary
在接口中BeanDefinition
isPrimary
public boolean isPrimary()
Return whether this bean is a primary autowire candidate.- 指定者:
isPrimary
在接口中BeanDefinition
addQualifier
public void addQualifier(AutowireCandidateQualifier qualifier)
Register a qualifier to be used for autowire candidate resolution, keyed by the qualifier's type name.
hasQualifier
public boolean hasQualifier(String typeName)
Return whether this bean has the specified qualifier.
getQualifier
public AutowireCandidateQualifier getQualifier(String typeName)
Return the qualifier mapped to the provided type name.
getQualifiers
public Set<AutowireCandidateQualifier> getQualifiers()
Return all registered qualifiers.- 返回:
- the Set of
AutowireCandidateQualifier
objects.
copyQualifiersFrom
public void copyQualifiersFrom(AbstractBeanDefinition source)
Copy the qualifiers from the supplied AbstractBeanDefinition to this bean definition.- 参数:
source
- the AbstractBeanDefinition to copy from
setNonPublicAccessAllowed
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. The default istrue
; switch this tofalse
for public access only.This applies to constructor resolution, factory method resolution, and also init/destroy methods. Bean property accessors have to be public in any case and are not affected by this setting.
Note that annotation-driven configuration will still access non-public members as far as they have been annotated. This setting applies to externalized metadata in this bean definition only.
isNonPublicAccessAllowed
public boolean isNonPublicAccessAllowed()
Return whether to allow access to non-public constructors and methods.
setLenientConstructorResolution
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).
isLenientConstructorResolution
public boolean isLenientConstructorResolution()
Return whether to resolve constructors in lenient mode or in strict mode.
setFactoryBeanName
public void setFactoryBeanName(String factoryBeanName)
Specify the factory bean to use, if any. This the name of the bean to call the specified factory method on.
getFactoryBeanName
public String getFactoryBeanName()
Return the factory bean name, if any.- 指定者:
getFactoryBeanName
在接口中BeanDefinition
setFactoryMethodName
public void setFactoryMethodName(String factoryMethodName)
Specify a factory method, if any. This method will be invoked with constructor arguments, or with no arguments if none are specified. The method will be invoked on the specified factory bean, if any, or otherwise as a static method on the local bean class.
getFactoryMethodName
public String getFactoryMethodName()
Return a factory method, if any.- 指定者:
getFactoryMethodName
在接口中BeanDefinition
setConstructorArgumentValues
public void setConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues)
Specify constructor argument values for this bean.
getConstructorArgumentValues
public ConstructorArgumentValues getConstructorArgumentValues()
Return constructor argument values for this bean (nevernull
).- 指定者:
getConstructorArgumentValues
在接口中BeanDefinition
- 返回:
- the ConstructorArgumentValues object (never
null
)
hasConstructorArgumentValues
public boolean hasConstructorArgumentValues()
Return if there are constructor argument values defined for this bean.
setPropertyValues
public void setPropertyValues(MutablePropertyValues propertyValues)
Specify property values for this bean, if any.
getPropertyValues
public MutablePropertyValues getPropertyValues()
Return property values for this bean (nevernull
).- 指定者:
getPropertyValues
在接口中BeanDefinition
- 返回:
- the MutablePropertyValues object (never
null
)
setMethodOverrides
public void setMethodOverrides(MethodOverrides methodOverrides)
Specify method overrides for the bean, if any.
getMethodOverrides
public MethodOverrides getMethodOverrides()
Return information about methods to be overridden by the IoC container. This will be empty if there are no method overrides.Never returns
null
.
setInitMethodName
public void setInitMethodName(String initMethodName)
Set the name of the initializer method.The default is
null
in which case there is no initializer method.
getInitMethodName
public String getInitMethodName()
Return the name of the initializer method.
setEnforceInitMethod
public void setEnforceInitMethod(boolean enforceInitMethod)
Specify whether or not the configured initializer method is the default.The default value is
true
for a locally specified init method but switched tofalse
for a shared setting in a defaults section (e.g.bean init-method
versusbeans default-init-method
level in XML) which might not apply to all contained bean definitions.
isEnforceInitMethod
public boolean isEnforceInitMethod()
Indicate whether the configured initializer method is the default.- 另请参阅:
getInitMethodName()
setDestroyMethodName
public void setDestroyMethodName(String destroyMethodName)
Set the name of the destroy method.The default is
null
in which case there is no destroy method.
getDestroyMethodName
public String getDestroyMethodName()
Return the name of the destroy method.
setEnforceDestroyMethod
public void setEnforceDestroyMethod(boolean enforceDestroyMethod)
Specify whether or not the configured destroy method is the default.The default value is
true
for a locally specified destroy method but switched tofalse
for a shared setting in a defaults section (e.g.bean destroy-method
versusbeans default-destroy-method
level in XML) which might not apply to all contained bean definitions.
isEnforceDestroyMethod
public boolean isEnforceDestroyMethod()
Indicate whether the configured destroy method is the default.
setSynthetic
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>
).
isSynthetic
public boolean isSynthetic()
Return whether this bean definition is 'synthetic', that is, not defined by the application itself.
setRole
public void setRole(int role)
Set the role hint for thisBeanDefinition
.
getRole
public int getRole()
Return the role hint for thisBeanDefinition
.
setDescription
public void setDescription(String description)
Set a human-readable description of this bean definition.
getDescription
public String getDescription()
Return a human-readable description of this bean definition.- 指定者:
getDescription
在接口中BeanDefinition
setResource
public void setResource(Resource resource)
Set the resource that this bean definition came from (for the purpose of showing context in case of errors).
getResource
public Resource getResource()
Return the resource that this bean definition came from.
setResourceDescription
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).
getResourceDescription
public String getResourceDescription()
Return a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).- 指定者:
getResourceDescription
在接口中BeanDefinition
setOriginatingBeanDefinition
public void setOriginatingBeanDefinition(BeanDefinition originatingBd)
Set the originating (e.g. decorated) BeanDefinition, if any.
getOriginatingBeanDefinition
public BeanDefinition getOriginatingBeanDefinition()
Return the originating BeanDefinition, ornull
if none. Allows for retrieving the decorated bean definition, if any.Note that this method returns the immediate originator. Iterate through the originator chain to find the original BeanDefinition as defined by the user.
validate
public void validate() throws BeanDefinitionValidationException
Validate this bean definition.- 抛出:
BeanDefinitionValidationException
- in case of validation failure
prepareMethodOverrides
public void prepareMethodOverrides() throws BeanDefinitionValidationException
Validate and prepare the method overrides defined for this bean. Checks for existence of a method with the specified name.- 抛出:
BeanDefinitionValidationException
- in case of validation failure
prepareMethodOverride
protected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException
Validate and prepare the given method override. Checks for existence of a method with the specified name, marking it as not overloaded if none found.- 参数:
mo
- the MethodOverride object to validate- 抛出:
BeanDefinitionValidationException
- in case of validation failure
clone
public Object clone()
Public declaration of Object'sclone()
method. Delegates tocloneBeanDefinition()
.- 覆盖:
clone
在类中Object
- 另请参阅:
Object.clone()
cloneBeanDefinition
public abstract AbstractBeanDefinition cloneBeanDefinition()
Clone this bean definition. To be implemented by concrete subclasses.- 返回:
- the cloned bean definition object
equals
public boolean equals(Object other)
- 覆盖:
equals
在类中AttributeAccessorSupport
hashCode
public int hashCode()
- 覆盖:
hashCode
在类中AttributeAccessorSupport