Annotation Interface AfterTransaction
@Target({METHOD,ANNOTATION_TYPE})
@Retention(RUNTIME)
@Documented
public @interface AfterTransaction
Test annotation which indicates that the annotated
void method
should be executed after a transaction is ended for a test method
configured to run within a transaction via Spring's @Transactional
annotation.
Generally speaking, @AfterTransaction methods must not accept any
arguments. However, as of Spring Framework 6.1, for tests using the
SpringExtension
with JUnit Jupiter, @AfterTransaction methods may optionally accept
arguments which will be resolved by any registered JUnit
ParameterResolver
extension such as the SpringExtension. This means that JUnit-specific
arguments like TestInfo or beans from
the test's ApplicationContext may be provided to @AfterTransaction
methods analogous to @AfterEach methods.
@AfterTransaction methods declared in superclasses or as interface
default methods will be executed after those of the current test class.
This annotation may be used as a meta-annotation to create custom composed annotations.
- Since:
- 2.5
- Author:
- Sam Brannen
- See Also: