Package org.springframework.test.context.bean.override

# Enum Class BeanOverrideStrategy

java.lang.Object
java.lang.Enum<BeanOverrideStrategy>
org.springframework.test.context.bean.override.BeanOverrideStrategy

All Implemented Interfaces:
  `Serializable`, `Comparable<BeanOverrideStrategy>`, `Constable`

public enum BeanOverrideStrategy extends Enum<BeanOverrideStrategy>
Strategies for bean override processing.

Since:
  6.2
Author:
  Simon Baslé, Stephane Nicoll, Sam Brannen

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`REPLACE`
Replace a given bean, immediately preparing a singleton instance.
`REPLACE_OR_CREATE`
Replace or create a given bean, immediately preparing a singleton instance.
`WRAP`
Intercept and process an early bean reference, allowing variants of bean overriding to wrap the original bean instance — for example, to delegate to actual methods in the context of a mocking "spy".

## Method Summary

Modifier and Type
Method
Description
`static BeanOverrideStrategy`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static BeanOverrideStrategy[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

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

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### REPLACE

public static final BeanOverrideStrategy REPLACE
Replace a given bean, immediately preparing a singleton instance.

Fails if the original bean does not exist. To create a new bean in such a case, use `REPLACE_OR_CREATE` instead.

### REPLACE_OR_CREATE

public static final BeanOverrideStrategy REPLACE_OR_CREATE
Replace or create a given bean, immediately preparing a singleton instance.

Contrary to `REPLACE`, this strategy creates a new bean if the target bean does not exist rather than failing.

### WRAP

public static final BeanOverrideStrategy WRAP
Intercept and process an early bean reference, allowing variants of bean overriding to wrap the original bean instance — for example, to delegate to actual methods in the context of a mocking "spy".

## Method Details

### values

public static BeanOverrideStrategy[] values()
Returns an array containing the constants of this enum class, in the order they are declared.

Returns:
  an array containing the constants of this enum class, in the order they are declared

### valueOf

public static BeanOverrideStrategy valueOf(String name)
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum class has no constant with the specified name
  `NullPointerException` - if the argument is null