From c9faefc5620e8d2c728d3081e4f5e9b4fa623589 Mon Sep 17 00:00:00 2001 From: pulsation Date: Mon, 7 Aug 2017 15:34:44 +0200 Subject: [PATCH] Clarify docs on effect RANDOM_PORT or DEFINED_PORT has on transactions Previously, when read too quickly, the current note may lead a user to think that RANDOM_PORT or DEFINED_PORT directly affect transaction management. This is not the case. This commit attempts to clarify that the difference in transaction behaviour is due to transactions being bound to a particular thread and separate threads being used for the client and server when tests are making HTTP requests. Closes gh-9965 --- .../src/main/asciidoc/spring-boot-features.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index a2a7006dada..1179590e974 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -5357,9 +5357,10 @@ how your tests will run: _any_ servlet environment (mock or otherwise). NOTE: If your test is `@Transactional`, it will rollback the transaction at the end of -each test method by default. If you're using this arrangement in combination with either -`RANDOM_PORT` or `DEFINED_PORT`, any transaction initiated on the server won't rollback as -the test is running in a different thread than the server processing. +each test method by default. However, as using this arrangement with either `RANDOM_PORT` +or `DEFINED_PORT` implicitly provides a real servlet environment, HTTP client and +server will run in separate threads, thus separate transactions. Any transaction +initiated on the server won't rollback in this case. NOTE: In addition to `@SpringBootTest` a number of other annotations are also provided for testing more specific slices of an application. See below for details.