Interface BeanDefinition
- All Superinterfaces:
- AttributeAccessor,- BeanMetadataElement
- All Known Subinterfaces:
- AnnotatedBeanDefinition
- All Known Implementing Classes:
- AbstractBeanDefinition,- AnnotatedGenericBeanDefinition,- ChildBeanDefinition,- GenericBeanDefinition,- RootBeanDefinition,- ScannedGenericBeanDefinition
This is just a minimal interface: The main intention is to allow a
 BeanFactoryPostProcessor to introspect and modify property values
 and other bean metadata.
- Since:
- 19.03.2004
- Author:
- Juergen Hoeller, Rob Harrop
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intRole hint indicating that aBeanDefinitionis a major part of the application.static final intRole hint indicating that aBeanDefinitionis providing an entirely background role and has no relevance to the end-user.static final intRole hint indicating that aBeanDefinitionis a supporting part of some larger configuration, typically an outerComponentDefinition.static final StringScope identifier for the standard prototype scope: "prototype".static final StringScope identifier for the standard singleton scope: "singleton".
- 
Method SummaryModifier and TypeMethodDescriptionReturn the current bean class name of this bean definition.Return the constructor argument values for this bean.String[]Return the bean names that this bean depends on.Return a human-readable description of this bean definition.Return the name of the destroy method.Return the factory bean name, if any.Return a factory method, if any.Return the name of the initializer method.Return the originating BeanDefinition, ornullif none.Return the name of the parent definition of this bean definition, if any.Return the property values to be applied to a new instance of the bean.Return a resolvable type for this bean definition, based on the bean class or other specific metadata.Return a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).intgetRole()Get the role hint for thisBeanDefinition.getScope()Return the name of the current target scope for this bean, ornullif not known yet.default booleanReturn if there are constructor argument values defined for this bean.default booleanReturn if there are property values defined for this bean.booleanReturn whether this bean is "abstract", that is, not meant to be instantiated.booleanReturn whether this bean is a candidate for getting autowired into some other bean.booleanReturn whether this bean should be lazily initialized, i.e.booleanReturn whether this bean is a primary autowire candidate.booleanReturn whether this a Prototype, with an independent instance returned for each call.booleanReturn whether this a Singleton, with a single, shared instance returned on all calls.voidsetAutowireCandidate(boolean autowireCandidate) Set whether this bean is a candidate for getting autowired into some other bean.voidsetBeanClassName(String beanClassName) Specify the bean class name of this bean definition.voidsetDependsOn(String... dependsOn) Set the names of the beans that this bean depends on being initialized.voidsetDescription(String description) Set a human-readable description of this bean definition.voidsetDestroyMethodName(String destroyMethodName) Set the name of the destroy method.voidsetFactoryBeanName(String factoryBeanName) Specify the factory bean to use, if any.voidsetFactoryMethodName(String factoryMethodName) Specify a factory method, if any.voidsetInitMethodName(String initMethodName) Set the name of the initializer method.voidsetLazyInit(boolean lazyInit) Set whether this bean should be lazily initialized.voidsetParentName(String parentName) Set the name of the parent definition of this bean definition, if any.voidsetPrimary(boolean primary) Set whether this bean is a primary autowire candidate.voidsetRole(int role) Set the role hint for thisBeanDefinition.voidOverride the target scope of this bean, specifying a new scope name.Methods inherited from interface org.springframework.core.AttributeAccessorattributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttributeMethods inherited from interface org.springframework.beans.BeanMetadataElementgetSource
- 
Field Details- 
SCOPE_SINGLETONScope identifier for the standard singleton scope: "singleton".Note that extended bean factories might support further scopes. 
- 
SCOPE_PROTOTYPEScope identifier for the standard prototype scope: "prototype".Note that extended bean factories might support further scopes. 
- 
ROLE_APPLICATIONstatic final int ROLE_APPLICATIONRole hint indicating that aBeanDefinitionis a major part of the application. Typically corresponds to a user-defined bean.- See Also:
 
- 
ROLE_SUPPORTstatic final int ROLE_SUPPORTRole hint indicating that aBeanDefinitionis a supporting part of some larger configuration, typically an outerComponentDefinition.SUPPORTbeans are considered important enough to be aware of when looking more closely at a particularComponentDefinition, but not when looking at the overall configuration of an application.- See Also:
 
- 
ROLE_INFRASTRUCTUREstatic final int ROLE_INFRASTRUCTURERole hint indicating that aBeanDefinitionis providing an entirely background role and has no relevance to the end-user. This hint is used when registering beans that are completely part of the internal workings of aComponentDefinition.- See Also:
 
 
- 
- 
Method Details- 
setParentNameSet the name of the parent definition of this bean definition, if any.
- 
getParentNameReturn the name of the parent definition of this bean definition, if any.
- 
setBeanClassNameSpecify the bean class name of this bean definition.The class name can be modified during bean factory post-processing, typically replacing the original class name with a parsed variant of it. 
- 
getBeanClassNameReturn the current bean class name of this bean definition.Note that this does not have to be the actual class name used at runtime, in case of a child definition overriding/inheriting the class name from its parent. Also, this may just be the class that a factory method is called on, or it may even be empty in case of a factory bean reference that a method is called on. Hence, do not consider this to be the definitive bean type at runtime but rather only use it for parsing purposes at the individual bean definition level. 
- 
setScopeOverride the target scope of this bean, specifying a new scope name.- See Also:
 
- 
getScopeReturn the name of the current target scope for this bean, ornullif not known yet.
- 
setLazyInitvoid 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.
- 
isLazyInitboolean isLazyInit()Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup. Only applicable to a singleton bean.
- 
setDependsOnSet the names of the beans that this bean depends on being initialized. The bean factory will guarantee that these beans get initialized first.
- 
getDependsOnReturn the bean names that this bean depends on.
- 
setAutowireCandidatevoid 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. 
- 
isAutowireCandidateboolean isAutowireCandidate()Return whether this bean is a candidate for getting autowired into some other bean.
- 
setPrimaryvoid setPrimary(boolean primary) Set whether this bean is a primary autowire candidate.If this value is truefor exactly one bean among multiple matching candidates, it will serve as a tie-breaker.
- 
isPrimaryboolean isPrimary()Return whether this bean is a primary autowire candidate.
- 
setFactoryBeanNameSpecify the factory bean to use, if any. This the name of the bean to call the specified factory method on.- See Also:
 
- 
getFactoryBeanNameReturn the factory bean name, if any.
- 
setFactoryMethodNameSpecify 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.
- 
getFactoryMethodNameReturn a factory method, if any.
- 
getConstructorArgumentValuesConstructorArgumentValues getConstructorArgumentValues()Return the constructor argument values for this bean.The returned instance can be modified during bean factory post-processing. - Returns:
- the ConstructorArgumentValues object (never null)
 
- 
hasConstructorArgumentValuesdefault boolean hasConstructorArgumentValues()Return if there are constructor argument values defined for this bean.- Since:
- 5.0.2
 
- 
getPropertyValuesMutablePropertyValues getPropertyValues()Return the property values to be applied to a new instance of the bean.The returned instance can be modified during bean factory post-processing. - Returns:
- the MutablePropertyValues object (never null)
 
- 
hasPropertyValuesdefault boolean hasPropertyValues()Return if there are property values defined for this bean.- Since:
- 5.0.2
 
- 
setInitMethodNameSet the name of the initializer method.- Since:
- 5.1
 
- 
getInitMethodNameReturn the name of the initializer method.- Since:
- 5.1
 
- 
setDestroyMethodNameSet the name of the destroy method.- Since:
- 5.1
 
- 
getDestroyMethodNameReturn the name of the destroy method.- Since:
- 5.1
 
- 
setRolevoid setRole(int role) Set the role hint for thisBeanDefinition. The role hint provides the frameworks as well as tools an indication of the role and importance of a particularBeanDefinition.- Since:
- 5.1
- See Also:
 
- 
getRoleint getRole()Get the role hint for thisBeanDefinition. The role hint provides the frameworks as well as tools an indication of the role and importance of a particularBeanDefinition.- See Also:
 
- 
setDescriptionSet a human-readable description of this bean definition.- Since:
- 5.1
 
- 
getDescriptionReturn a human-readable description of this bean definition.
- 
getResolvableTypeResolvableType getResolvableType()Return a resolvable type for this bean definition, based on the bean class or other specific metadata.This is typically fully resolved on a runtime-merged bean definition but not necessarily on a configuration-time definition instance. - Returns:
- the resolvable type (potentially ResolvableType.NONE)
- Since:
- 5.2
- See Also:
 
- 
isSingletonboolean isSingleton()Return whether this a Singleton, with a single, shared instance returned on all calls.- See Also:
 
- 
isPrototypeboolean isPrototype()Return whether this a Prototype, with an independent instance returned for each call.- Since:
- 3.0
- See Also:
 
- 
isAbstractboolean isAbstract()Return whether this bean is "abstract", that is, not meant to be instantiated.
- 
getResourceDescriptionReturn a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).
- 
getOriginatingBeanDefinitionReturn the originating BeanDefinition, ornullif 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. 
 
-