Document that the SpringExtension requires JUnit Jupiter 6.0 or higher

Closes gh-35900
This commit is contained in:
Sam Brannen 2025-11-26 15:47:21 +01:00
parent f58d0f6aae
commit c1125699bb
2 changed files with 11 additions and 6 deletions

View File

@ -8,12 +8,15 @@ in JUnit and TestNG.
[[testcontext-junit-jupiter-extension]]
== SpringExtension for JUnit Jupiter
The Spring TestContext Framework offers full integration with the JUnit Jupiter testing
framework, originally introduced in JUnit 5. By annotating test classes with
`@ExtendWith(SpringExtension.class)`, you can implement standard JUnit Jupiter-based unit
and integration tests and simultaneously reap the benefits of the TestContext framework,
such as support for loading application contexts, dependency injection of test instances,
transactional test method execution, and so on.
The `SpringExtension` integrates the Spring TestContext Framework into the JUnit Jupiter
testing framework.
NOTE: As of Spring Framework 7.0, the `SpringExtension` requires JUnit Jupiter 6.0 or higher.
By annotating test classes with `@ExtendWith(SpringExtension.class)`, you can implement
standard JUnit Jupiter-based unit and integration tests and simultaneously reap the
benefits of the TestContext framework, such as support for loading application contexts,
dependency injection of test instances, transactional test method execution, and so on.
Furthermore, thanks to the rich extension API in JUnit Jupiter, Spring provides the
following features above and beyond the feature set that Spring supports for JUnit 4 and

View File

@ -90,6 +90,8 @@ import org.springframework.util.ReflectionUtils.MethodFilter;
* {@link SpringExtensionConfig#useTestClassScopedExtensionContext()
* @SpringExtensionConfig(useTestClassScopedExtensionContext = true)}.
*
* <p><strong>NOTE:</strong> This class requires JUnit Jupiter 6.0 or higher.
*
* @author Sam Brannen
* @author Simon Baslé
* @since 5.0