Annotation Interface BeanOverride


@Retention(RUNTIME) @Target(ANNOTATION_TYPE) @Documented @Reflective(org.springframework.test.context.bean.override.BeanOverrideReflectiveProcessor.class) public @interface BeanOverride
Mark a composed annotation as eligible for Bean Override processing.

Specifying this annotation registers the configured BeanOverrideProcessor which must be capable of handling the composed annotation and its attributes.

Since the composed annotation will typically only be applied to non-static fields, it is expected that the composed annotation is meta-annotated with @Target(ElementType.FIELD). However, certain bean override annotations may be declared with an additional ElementType.TYPE target for use at the type level. Similarly, as of Spring Framework 7.1, certain bean override annotations may be declared with an additional ElementType.PARAMETER target for use on constructor parameters. For example, @MockitoBean can be declared on a field, constructor parameter, test class, or test interface.

For concrete examples of such composed annotations, see @TestBean, @MockitoBean, and @MockitoSpyBean.

Since:
6.2
Author:
Simon Baslé, Sam Brannen