My Email is [email protected]
Please note that questions like this are more suitable for Stack Overflow using the junit5 tag.
In any case, it's quite easy to use Spring with JUnit 5 via the SpringExtension for JUnit Jupiter.
If you are using Spring Framework 5.0 milestone releases, the SpringExtension is available in the spring-test JAR. If you're using Spring Framework 4.3, the SpringExtension is only available if you build the spring-test-junit5 JAR yourself from my repository: https://github.com/sbrannen/spring-test-junit5
Then, to use Spring with JUnit 5 (i.e., in JUnit Jupiter tests), simply register the extension like this: @ExtendWith(SpringExtension.class).
As an alternative, you can use one of the @SpringJUnitJupiterConfig or @SpringJUnitJupiterWebConfig composed annotations to simplify matters.
Regards,
Sam (author of the Spring TestContext Framework)
If you're using Spring Framework 4.3, the SpringExtension is only available if you build the spring-test-junit5 JAR yourself from my repository: https://github.com/sbrannen/spring-test-junit5
Or you can use jitpack.io.
Most helpful comment
Please note that questions like this are more suitable for Stack Overflow using the
junit5tag.In any case, it's quite easy to use Spring with JUnit 5 via the
SpringExtensionfor JUnit Jupiter.If you are using Spring Framework 5.0 milestone releases, the
SpringExtensionis available in thespring-testJAR. If you're using Spring Framework 4.3, theSpringExtensionis only available if you build thespring-test-junit5JAR yourself from my repository: https://github.com/sbrannen/spring-test-junit5Then, to use Spring with JUnit 5 (i.e., in JUnit Jupiter tests), simply register the extension like this:
@ExtendWith(SpringExtension.class).As an alternative, you can use one of the
@SpringJUnitJupiterConfigor@SpringJUnitJupiterWebConfigcomposed annotations to simplify matters.Regards,
Sam (author of the Spring TestContext Framework)