Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.beans.factory.config
Interface BeanDefinition

All Superinterfaces:
  AttributeAccessor, BeanMetadataElement

All Known Subinterfaces:
  AnnotatedBeanDefinition

All Known Implementing Classes:
  AbstractBeanDefinition, AnnotatedGenericBeanDefinition, ChildBeanDefinition, GenericBeanDefinition, RootBeanDefinition, ScannedGenericBeanDefinition

    public interface BeanDefinition

extends AttributeAccessor, BeanMetadataElement

A BeanDefinition describes a bean instance, which has property values, constructor argument values, and further information supplied by concrete implementations.

This is just a minimal interface: The main intention is to allow a `BeanFactoryPostProcessor` such as `PropertyPlaceholderConfigurer` to introspect and modify property values and other bean metadata.

Since:
  19.03.2004
Author:
  Juergen Hoeller, Rob Harrop
See Also:
  `ConfigurableListableBeanFactory.getBeanDefinition(java.lang.String)`, `RootBeanDefinition`, `ChildBeanDefinition`

Field Summary
`static int` | `ROLE_APPLICATION` Role hint indicating that a `BeanDefinition` is a major part of the application.
`static int` | `ROLE_INFRASTRUCTURE` Role hint indicating that a `BeanDefinition` is providing an entirely background role and has no relevance to the end-user.
`static int` | `ROLE_SUPPORT` Role hint indicating that a `BeanDefinition` is a supporting part of some larger configuration, typically an outer `ComponentDefinition`.
`static java.lang.String` | `SCOPE_PROTOTYPE` Scope identifier for the standard prototype scope: "prototype".
`static java.lang.String` | `SCOPE_SINGLETON` Scope identifier for the standard singleton scope: "singleton".

Method Summary
`java.lang.String` | `getBeanClassName()` Return the current bean class name of this bean definition.
`ConstructorArgumentValues` | `getConstructorArgumentValues()` Return the constructor argument values for this bean.
`java.lang.String[]` | `getDependsOn()` Return the bean names that this bean depends on.
`java.lang.String` | `getDescription()` Return a human-readable description of this bean definition.
`java.lang.String` | `getFactoryBeanName()` Return the factory bean name, if any.
`java.lang.String` | `getFactoryMethodName()` Return a factory method, if any.
`BeanDefinition` | `getOriginatingBeanDefinition()` Return the originating BeanDefinition, or `null` if none.
`java.lang.String` | `getParentName()` Return the name of the parent definition of this bean definition, if any.
`MutablePropertyValues` | `getPropertyValues()` Return the property values to be applied to a new instance of the bean.
`java.lang.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()` Get the role hint for this `BeanDefinition`.
`java.lang.String` | `getScope()` Return the name of the current target scope for this bean, or `null` if not known yet.
`boolean` | `isAbstract()` Return whether this bean is "abstract", that is, not meant to be instantiated.
`boolean` | `isAutowireCandidate()` Return whether this bean is a candidate for getting autowired into some other bean.
`boolean` | `isLazyInit()` Return whether this bean should be lazily initialized, i.e.
`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 on all calls.
`void` | `setAutowireCandidate(boolean autowireCandidate)` Set whether this bean is a candidate for getting autowired into some other bean.
`void` | `setBeanClassName(java.lang.String beanClassName)` Override the bean class name of this bean definition.
`void` | `setDependsOn(java.lang.String[] dependsOn)` Set the names of the beans that this bean depends on being initialized.
`void` | `setFactoryBeanName(java.lang.String factoryBeanName)` Specify the factory bean to use, if any.
`void` | `setFactoryMethodName(java.lang.String factoryMethodName)` Specify a factory method, if any.
`void` | `setLazyInit(boolean lazyInit)` Set whether this bean should be lazily initialized.
`void` | `setParentName(java.lang.String parentName)` Set the name of the parent definition of this bean definition, if any.
`void` | `setPrimary(boolean primary)` Set whether this bean is a primary autowire candidate.
`void` | `setScope(java.lang.String scope)` Override the target scope of this bean, specifying a new scope name.

Methods inherited from interface org.springframework.core.AttributeAccessor
`attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute`

Methods inherited from interface org.springframework.beans.BeanMetadataElement
`getSource`

Field Detail

### SCOPE_SINGLETON

    static final java.lang.String SCOPE_SINGLETON

  Scope identifier for the standard singleton scope: "singleton".

  Note that extended bean factories might support further scopes.

  See Also:
    `setScope(java.lang.String)`, Constant Field Values

### SCOPE_PROTOTYPE

    static final java.lang.String SCOPE_PROTOTYPE

  Scope identifier for the standard prototype scope: "prototype".

  Note that extended bean factories might support further scopes.

  See Also:
    `setScope(java.lang.String)`, Constant Field Values

### ROLE_APPLICATION

    static final int ROLE_APPLICATION

  Role hint indicating that a `BeanDefinition` is a major part of the application. Typically corresponds to a user-defined bean.

  See Also:
    Constant Field Values

### ROLE_SUPPORT

    static final int ROLE_SUPPORT

  Role hint indicating that a `BeanDefinition` is a supporting part of some larger configuration, typically an outer `ComponentDefinition`. `SUPPORT` beans are considered important enough to be aware of when looking more closely at a particular `ComponentDefinition`, but not when looking at the overall configuration of an application.

  See Also:
    Constant Field Values

### ROLE_INFRASTRUCTURE

    static final int ROLE_INFRASTRUCTURE

  Role hint indicating that a `BeanDefinition` is 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 a `ComponentDefinition`.

  See Also:
    Constant Field Values

Method Detail

### getParentName

    java.lang.String getParentName()

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

### setParentName

    void setParentName(java.lang.String parentName)

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

### getBeanClassName

    java.lang.String getBeanClassName()

  Return 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. 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.

### setBeanClassName

    void setBeanClassName(java.lang.String beanClassName)

  Override 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.

### getFactoryBeanName

    java.lang.String getFactoryBeanName()

  Return the factory bean name, if any.

### setFactoryBeanName

    void setFactoryBeanName(java.lang.String factoryBeanName)

  Specify the factory bean to use, if any.

### getFactoryMethodName

    java.lang.String getFactoryMethodName()

  Return a factory method, if any.

### setFactoryMethodName

    void setFactoryMethodName(java.lang.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.

  Parameters:
    `factoryMethodName` - static factory method name, or `null` if normal constructor creation should be used
  See Also:
    `getBeanClassName()`

### getScope

    java.lang.String getScope()

  Return the name of the current target scope for this bean, or `null` if not known yet.

### setScope

    void setScope(java.lang.String scope)

  Override the target scope of this bean, specifying a new scope name.

  See Also:
    `SCOPE_SINGLETON`, `SCOPE_PROTOTYPE`

### isLazyInit

    boolean isLazyInit()

  Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup. Only applicable to a singleton bean.

### setLazyInit

    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.

### getDependsOn

    java.lang.String[] getDependsOn()

  Return the bean names that this bean depends on.

### setDependsOn

    void setDependsOn(java.lang.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.

### isAutowireCandidate

    boolean isAutowireCandidate()

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

### setAutowireCandidate

    void setAutowireCandidate(boolean autowireCandidate)

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

### isPrimary

    boolean isPrimary()

  Return 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

    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.

### getConstructorArgumentValues

    ConstructorArgumentValues 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`)

### getPropertyValues

    MutablePropertyValues 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`)

### isSingleton

    boolean isSingleton()

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

  See Also:
    `SCOPE_SINGLETON`

### isPrototype

    boolean isPrototype()

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

  See Also:
    `SCOPE_PROTOTYPE`

### isAbstract

    boolean isAbstract()

  Return whether this bean is "abstract", that is, not meant to be instantiated.

### getRole

    int getRole()

  Get the role hint for this `BeanDefinition`. The role hint provides tools with an indication of the importance of a particular `BeanDefinition`.

  See Also:
    `ROLE_APPLICATION`, `ROLE_INFRASTRUCTURE`, `ROLE_SUPPORT`

### getDescription

    java.lang.String getDescription()

  Return a human-readable description of this bean definition.

### getResourceDescription

    java.lang.String getResourceDescription()

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

### getOriginatingBeanDefinition

    BeanDefinition getOriginatingBeanDefinition()

  Return the originating BeanDefinition, or `null` 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD