Annotation Interface ContextCustomizerFactories
@ContextCustomizerFactories defines class-level metadata for configuring
which ContextCustomizerFactory implementations should be registered with
the Spring TestContext Framework.
@ContextCustomizerFactories is used to register factories for a
particular test class, its subclasses, and its nested classes. If you wish to
register a factory globally, you should register it via the automatic discovery
mechanism described in ContextCustomizerFactory.
This annotation may be used as a meta-annotation to create custom
composed annotations. In addition, this annotation will be inherited
from an enclosing test class by default. See
@NestedTestConfiguration for details.
- Since:
- 6.1
- Author:
- Sam Brannen
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of modes that dictate whether explicitly declared factories are merged with the default factories when@ContextCustomizerFactoriesis declared on a class that does not inherit factories from a superclass or enclosing class. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends ContextCustomizerFactory>[]TheContextCustomizerFactoryimplementations to register.booleanWhether the configured set offactories()from superclasses and enclosing classes should be inherited.The merge mode to use when@ContextCustomizerFactoriesis declared on a class that does not inherit factories from a superclass or enclosing class.Class<? extends ContextCustomizerFactory>[]Alias forfactories().
-
Element Details
-
value
Alias forfactories().This attribute may not be used in conjunction with
factories(), but it may be used instead offactories().- Default:
- {}
-
factories
TheContextCustomizerFactoryimplementations to register.This attribute may not be used in conjunction with
value(), but it may be used instead ofvalue().- Default:
- {}
-
inheritFactories
boolean inheritFactoriesWhether the configured set offactories()from superclasses and enclosing classes should be inherited.The default value is
true, which means that an annotated class will inherit the factories defined by an annotated superclass or enclosing class. Specifically, the factories for an annotated class will be appended to the list of factories defined by an annotated superclass or enclosing class. Thus, subclasses and nested classes have the option of extending the list of factories.If
inheritListenersis set tofalse, the factories for the annotated class will shadow and effectively replace any factories defined by a superclass or enclosing class.- Default:
- true
-
mergeMode
ContextCustomizerFactories.MergeMode mergeModeThe merge mode to use when@ContextCustomizerFactoriesis declared on a class that does not inherit factories from a superclass or enclosing class.Can be set to
REPLACE_DEFAULTSto have locally declared factories replace the default factories.The mode is ignored if factories are inherited from a superclass or enclosing class.
Defaults to
MERGE_WITH_DEFAULTS.- See Also:
- Default:
- MERGE_WITH_DEFAULTS
-