Skip to content

Commit 0721608

Browse files
committed
Add a note about transactional tests and webEnvironment
Closes gh-8232
1 parent 40f4c89 commit 0721608

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5062,6 +5062,11 @@ how your tests will run:
50625062
* `NONE` -- Loads an `ApplicationContext` using `SpringApplication` but does not provide
50635063
_any_ servlet environment (mock or otherwise).
50645064

5065+
NOTE: If your test is `@Transactional`, it will rollback the transaction at the end of
5066+
each test method by default. If you're using this arrangement in combination with either
5067+
`RANDOM_PORT` or `DEFINED_PORT`, any transaction initiated on the server won't rollback as
5068+
the test is running in a different thread than the server processing.
5069+
50655070
NOTE: In addition to `@SpringBootTest` a number of other annotations are also
50665071
provided for testing more specific slices of an application. See below for details.
50675072

0 commit comments

Comments
 (0)