@@ -3520,17 +3520,25 @@ Annotating a test method with `@Transactional` causes the test to be run within
35203520transaction that is, by default, automatically rolled back after completion of the test.
35213521If a test class is annotated with `@Transactional`, each test method within that class
35223522hierarchy runs within a transaction. Test methods that are not annotated with
3523- `@Transactional` (at the class or method level) are not run within a transaction.
3524- Furthermore, tests that are annotated with `@Transactional` but have the `propagation`
3525- type set to `NOT_SUPPORTED` are not run within a transaction.
3523+ `@Transactional` (at the class or method level) are not run within a transaction. Note
3524+ that `@Transactional` is not supported on test lifecycle methods — for example, methods
3525+ annotated with JUnit Jupiter's `@BeforeAll`, `@BeforeEach`, etc. Furthermore, tests that
3526+ are annotated with `@Transactional` but have the `propagation` type set to
3527+ `NOT_SUPPORTED` are not run within a transaction.
35263528
35273529[TIP]
35283530====
3529- When using TestNG `@BeforeClass`,`@BeforeSuite` methods can not be used with the
3530- `@Transactional` annotation, as they are considered non transactional methods by the
3531- the spring text contetxt framework. However, you can inject a `PlatfromTransactionManager`
3532- or a `TransactionTemplate` and use it within `@BeforeClass` method to perform a
3533- transaction.
3531+ Method-level lifecycle methods — for example, methods annotated with JUnit Jupiter's
3532+ `@BeforeEach` or `@AfterEach` — are run within a test-managed transaction. On the other
3533+ hand, suite-level and class-level lifecycle methods — for example, methods annotated with
3534+ JUnit Jupiter's `@BeforeAll` or `@AfterAll` and methods annotated with TestNG's
3535+ `@BeforeSuite`, `@AfterSuite`, `@BeforeClass`, or `@AfterClass` — are _not_ run within a
3536+ test-managed transaction.
3537+
3538+ If you need to execute code in a suite-level or class-level lifecycle method within a
3539+ transaction, you may wish to inject a corresponding `PlatformTransactionManager` into
3540+ your test class and then use that with a `TransactionTemplate` for programmatic
3541+ transaction management.
35343542====
35353543
35363544Note that <<testcontext-support-classes-junit4,
0 commit comments