Annotation Interface SpringExtensionConfig


@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited public @interface SpringExtensionConfig
@SpringExtensionConfig is a type-level annotation that can be used to configure the behavior of the SpringExtension.

This annotation is only applicable to @Nested test class hierarchies and should be applied to the top-level enclosing class of a @Nested test class hierarchy. Consequently, there is no need to declare this annotation on a test class that does not contain @Nested test classes.

Note that @NestedTestConfiguration does not apply to this annotation: @SpringExtensionConfig will always be detected within a @Nested test class hierarchy, effectively disregarding any @NestedTestConfiguration(OVERRIDE) declarations.

Since:
7.0
Author:
Sam Brannen
See Also:
  • Element Details

    • useTestClassScopedExtensionContext

      boolean useTestClassScopedExtensionContext
      Specify whether the SpringExtension should use a test-class scoped ExtensionContext within @Nested test class hierarchies.

      By default, the SpringExtension uses a test-method scoped ExtensionContext. Thus, there is no need to declare this annotation attribute with a value of false.

      Similarly, if your top-level test class is configured to use JUnit Jupiter’s @TestInstance(Lifecycle.PER_CLASS) semantics, the SpringExtension will always use a test-class scoped ExtensionContext, and there is no need to declare @SpringExtensionConfig(useTestClassScopedExtensionContext = true).

      Furthermore, this attribute takes precedence over global configuration of the spring.test.extension.context.scope property.

      See Also: