Annotation Interface ContextCustomizerFactories


@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited public @interface ContextCustomizerFactories
@ContextCustomizerFactories is an annotation that can be applied to a test class to configure 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:
  • Element Details

    • value

      @AliasFor("factories") Class<? extends ContextCustomizerFactory>[] value
      Alias for factories().

      This attribute may not be used in conjunction with factories(), but it may be used instead of factories().

      Default:
      {}
    • factories

      @AliasFor("value") Class<? extends ContextCustomizerFactory>[] factories
      The ContextCustomizerFactory implementations to register.

      This attribute may not be used in conjunction with value(), but it may be used instead of value().

      Default:
      {}
    • inheritFactories

      boolean inheritFactories
      Whether the configured set of factories() 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 inheritListeners is set to false, the factories for the annotated class will shadow and effectively replace any factories defined by a superclass or enclosing class.

      Default:
      true
    • mergeMode

      The merge mode to use when @ContextCustomizerFactories is declared on a class that does not inherit factories from a superclass or enclosing class.

      Can be set to REPLACE_DEFAULTS to 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