Annotation Interface ContextCustomizerFactories
@ContextCustomizerFactories defines class-level metadata for configuring
which ContextCustomizerFactory implementations should be registered with
the Infra 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.
- 从以下版本开始:
- 4.0 2023/9/17 21:14
- 作者:
- Sam Brannen, Harry Yang
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明static 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. -
可选元素概要
可选元素修饰符和类型可选元素说明Class<? 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().
-
元素详细资料
-
value
Alias forfactories().This attribute may not be used in conjunction with
factories(), but it may be used instead offactories().- 默认值:
- {}
-
factories
TheContextCustomizerFactoryimplementations to register.This attribute may not be used in conjunction with
value(), but it may be used instead ofvalue().- 默认值:
- {}
-
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.- 默认值:
- 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.- 默认值:
- MERGE_WITH_DEFAULTS
-