spring-framework / org.springframework.test.context.transaction

Package org.springframework.test.context.transaction

Types

TestContextTransactionUtils

abstract class TestContextTransactionUtils

Utility methods for working with transactions and data access related beans within the Spring TestContext Framework.

Mainly for internal use within the framework.

TestTransaction

open class TestTransaction

TestTransaction provides a collection of static utility methods for programmatic interaction with test-managed transactions within test methods, before methods, and after methods.

Consult the javadocs for TransactionalTestExecutionListener for a detailed explanation of test-managed transactions.

Support for TestTransaction is automatically available whenever the TransactionalTestExecutionListener is enabled. Note that the TransactionalTestExecutionListener is typically enabled by default, but it can also be manually enabled via the TestExecutionListeners annotation.

Annotations

AfterTransaction

class 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.

As of Spring Framework 4.3, @AfterTransaction may be declared on Java 8 based interface default methods.

@AfterTransaction methods declared in superclasses or as interface default methods will be executed after those of the current test class.

As of Spring Framework 4.0, this annotation may be used as a meta-annotation to create custom composed annotations.

BeforeTransaction

class BeforeTransaction

Test annotation which indicates that the annotated void method should be executed before a transaction is started for a test method configured to run within a transaction via Spring's @Transactional annotation.

As of Spring Framework 4.3, @BeforeTransaction may be declared on Java 8 based interface default methods.

@BeforeTransaction methods declared in superclasses or as interface default methods will be executed before those of the current test class.

As of Spring Framework 4.0, this annotation may be used as a meta-annotation to create custom composed annotations.