Introduce @Commit alias for @Rollback(false)
Due to common usage of @Rollback(false), this commit introduces a new @Commit annotation that more clearly conveys the intent of the code while retaining the run-time semantics. @Commit is in fact meta-annotated with @Rollback(false). Issue: SPR-13279
This commit is contained in:
@@ -799,13 +799,36 @@ for an example and further details.
|
||||
|
||||
+
|
||||
|
||||
* `@Commit`
|
||||
|
||||
+
|
||||
|
||||
Indicates that the transaction for a transactional test method should be __committed__
|
||||
after the test method has completed. `@Commit` can be used as a direct replacement for
|
||||
`@Rollback(false)` in order to more explicitly convey the intent of the code. Analogous to
|
||||
`@Rollback`, `@Commit` may also be declared as a class-level or method-level annotation.
|
||||
|
||||
+
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
**@Commit**
|
||||
@Test
|
||||
public void testProcessWithoutRollback() {
|
||||
// ...
|
||||
}
|
||||
----
|
||||
|
||||
* `@Rollback`
|
||||
|
||||
+
|
||||
|
||||
Indicates whether the transaction for a transactional test method should be __rolled
|
||||
back__ after the test method has completed. If `true`, the transaction is rolled back;
|
||||
otherwise, the transaction is committed.
|
||||
otherwise, the transaction is committed. Rollback semantics for integration tests in the
|
||||
Spring TestContext Framework default to `true` even if `@Rollback` is not explicitly
|
||||
declared.
|
||||
|
||||
+
|
||||
|
||||
|
||||
Reference in New Issue
Block a user