Package org.springframework.beans.factory.support

# Class BeanDefinitionDefaults

java.lang.Object
org.springframework.beans.factory.support.BeanDefinitionDefaults

public class BeanDefinitionDefaults extends Object
A simple holder for `BeanDefinition` property defaults.

Since:
  2.5
Author:
  Mark Fisher, Juergen Hoeller
See Also:
  - `AbstractBeanDefinition.applyDefaults(org.springframework.beans.factory.support.BeanDefinitionDefaults)`

## Constructor Summary

Constructors
Constructor
Description
`BeanDefinitionDefaults()`

## Method Summary

Modifier and Type
Method
Description
`int`
`getAutowireMode()`
Return the default autowire mode.
`int`
`getDependencyCheck()`
Return the default dependency check code.
`String`
`getDestroyMethodName()`
Return the name of the default destroy method.
`String`
`getInitMethodName()`
Return the name of the default initializer method.
`Boolean`
`getLazyInit()`
Return whether beans should be lazily initialized by default, i.e.
`boolean`
`isLazyInit()`
Return whether beans should be lazily initialized by default, i.e.
`void`
`setAutowireMode(int autowireMode)`
Set the autowire mode.
`void`
`setDependencyCheck(int dependencyCheck)`
Set the dependency check code.
`void`
`setDestroyMethodName(String destroyMethodName)`
Set the name of the default destroy method.
`void`
`setInitMethodName(String initMethodName)`
Set the name of the default initializer method.
`void`
`setLazyInit(boolean lazyInit)`
Set whether beans should be lazily initialized by default.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### BeanDefinitionDefaults

public BeanDefinitionDefaults()

## Method Details

### setLazyInit

public void setLazyInit(boolean lazyInit)
Set whether beans should be lazily initialized by default.

If `false`, the bean will get instantiated on startup by bean factories that perform eager initialization of singletons.

See Also:
  - `AbstractBeanDefinition.setLazyInit(boolean)`

### isLazyInit

public boolean isLazyInit()
Return whether beans should be lazily initialized by default, i.e. not eagerly instantiated on startup. Only applicable to singleton beans.

Returns:
  whether to apply lazy-init semantics (`false` by default)

### getLazyInit

@Nullable public Boolean getLazyInit()
Return whether beans should be lazily initialized by default, i.e. not eagerly instantiated on startup. Only applicable to singleton beans.

Returns:
  the lazy-init flag if explicitly set, or `null` otherwise
Since:
  5.2

### 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).

Parameters:
  `autowireMode` - the autowire mode to set. Must be one of the constants defined in `AbstractBeanDefinition`.
See Also:
  - `AbstractBeanDefinition.setAutowireMode(int)`

### getAutowireMode

public int getAutowireMode()
Return the default autowire mode.

### setDependencyCheck

public void setDependencyCheck(int dependencyCheck)
Set the dependency check code.

Parameters:
  `dependencyCheck` - the code to set. Must be one of the constants defined in `AbstractBeanDefinition`.
See Also:
  - `AbstractBeanDefinition.setDependencyCheck(int)`

### getDependencyCheck

public int getDependencyCheck()
Return the default dependency check code.

### setInitMethodName

public void setInitMethodName(@Nullable String initMethodName)
Set the name of the default initializer method.

Note that this method is not enforced on all affected bean definitions but rather taken as an optional callback, to be invoked if actually present.

See Also:
  - `AbstractBeanDefinition.setInitMethodName(java.lang.String)`
  - `AbstractBeanDefinition.setEnforceInitMethod(boolean)`

### getInitMethodName

@Nullable public String getInitMethodName()
Return the name of the default initializer method.

### setDestroyMethodName

public void setDestroyMethodName(@Nullable String destroyMethodName)
Set the name of the default destroy method.

Note that this method is not enforced on all affected bean definitions but rather taken as an optional callback, to be invoked if actually present.

See Also:
  - `AbstractBeanDefinition.setDestroyMethodName(java.lang.String)`
  - `AbstractBeanDefinition.setEnforceDestroyMethod(boolean)`

### getDestroyMethodName

@Nullable public String getDestroyMethodName()
Return the name of the default destroy method.