Generated by
JDiff

org.springframework.test.context.transaction Documentation Differences

This file contains all the changes in documentation in the package org.springframework.test.context.transaction as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class TransactionalTestExecutionListener

{@code TestExecutionListener} that provides support for executing tests within transactions by honoring the @Transactional and @NotTransactional annotations. Expects a PlatformTransactionManager bean to be defined in the Spring ApplicationContext for the test.

Changes to the database during a test that is run with {@code @Transactional} will be run within a transaction that will, by default, be automatically rolled back after completion of the test; whereas, changes to the database during a test that is run with {@code @NotTransactional} will not be run within a transaction. Test methods that are not annotated with either {@code @Transactional} (at the class or method level) or {@code @NotTransactional} will notnot be run within a transaction.

Transactional commit and rollback behavior can be configured via the class-level @TransactionConfiguration and method-level @Rollback annotations.

In case there are multiple instances of {@code PlatformTransactionManager} within the test's {@code ApplicationContext}, @{@code @TransactionConfiguration} supports configuring the bean name of the {@code PlatformTransactionManager} that should be used to drive transactions. Alternatively, TransactionManagementConfigurer can be implemented in an @Configuration class.

When executing transactional tests, it is sometimes useful to be able to execute certain set up or tear down code outside of a transaction. {@code TransactionalTestExecutionListener} provides such support for methods annotated with @BeforeTransaction and @AfterTransaction. @author Sam Brannen @author Juergen Hoeller @since 2.5 @see TransactionConfiguration @see TransactionManagementConfigurer @see org.springframework.transaction.annotation.Transactional @see org.springframework.test.annotation.NotTransactional @see org.springframework.test.annotation.Rollback @see BeforeTransaction @see AfterTransaction

Class TransactionalTestExecutionListener, void afterTestMethod(TestContext)

If a transaction is currently active for the test method of the supplied test context, this method will end the transaction and run @AfterTransaction methods.

{@code AfterTransaction @@AfterTransaction} methods} are guaranteed to be invoked even if an error occurs while ending the transaction.

Class TransactionalTestExecutionListener, void beforeTestMethod(TestContext)

If the test method of the supplied test context is configured to run within a transaction, this method will run @BeforeTransaction methods and start a new transaction.

Note that if a {@code BeforeTransaction @@BeforeTransaction} method} fails, any remainingremaining {@code BeforeTransaction @@BeforeTransaction} methods} will not not be invoked, and a transactiontransaction will not be started. @see org.springframework.transaction.annotation.Transactional @see org.springframework.test.annotation.NotTransactional @see #getTransactionManager(TestContext, String)