From 08bc0460ed10d5f05d7c1a56b699390cc2a9e37c Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Mon, 22 Apr 2024 16:47:29 -0500 Subject: [PATCH] Document usage of Docker Compose support in tests Closes gh-40171 --- .../asciidoc/features/docker-compose.adoc | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/docker-compose.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/docker-compose.adoc index 6ee9c0172a7..c8672860556 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/docker-compose.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/docker-compose.adoc @@ -38,9 +38,6 @@ When this module is included as a dependency Spring Boot will do the following: If the Docker Compose services are already running when starting the application, Spring Boot will only create the service connection beans for each supported container. It will not call `docker compose up` again and it will not call `docker compose stop` when the application is shutdown. -NOTE: By default, Spring Boot's Docker Compose support is disabled when running tests. -To enable it, set configprop:spring.docker.compose.skip.in-tests[] to `false`. - [[features.docker-compose.prerequisites]] @@ -256,3 +253,23 @@ If you want to activate a specific Docker Compose profile you can use the config profiles: active: "myprofile" ---- + + + +[[features.docker-compose.tests]] +=== Using Docker Compose in Tests + +By default, Spring Boot's Docker Compose support is disabled when running tests. + +To enable Docker Compose support in tests, set configprop:spring.docker.compose.skip.in-tests[] to `false`. + +When using Gradle, you also need to change the configuration of the `spring-boot-docker-compose` dependency from `developmentOnly` to `testAndDevelopmentOnly`: + +.Gradle +[source,gradle,indent=0,subs="verbatim"] +---- + dependencies { + testAndDevelopmentOnly("org.springframework.boot:spring-boot-docker-compose") + } +---- +