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 42289ac18a..3c2b314aec 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -3844,6 +3844,21 @@ in order to run your integration tests using random ports. For example: } ---- +Alternatively, you can use the `randomPort` convenience attribute to set `server.port=0`. +For example: + +[source,java,indent=0,subs="verbatim,quotes,attributes"] +---- + @RunWith(SpringJUnit4ClassRunner.class) + @SpringApplicationConfiguration(MyApplication.class) + @WebIntegrationTest(randomPort = true) + public class SomeIntegrationTests { + + // ... + + } +---- + See <> for a description of how you can discover the actual port that was allocated for the duration of the tests.