I have a repository which contains multiple Spring Boot applications and I would like to use compose.yml files for local development.

project_root:
   - catalog
       - src
       - pom.xml
       - compose.yml
   - orders
       - src
       - pom.xml
       - compose.yml 

I have added org.springframework.boot:spring-boot-docker-compose dependency in each application. When I start the CatalogApplication/OrdersApplication from IntelliJ IDEA, it expects the compose.yml file to be in project_root not inside catalog or orders directory.

But if I run mvn spring-boot:run from catalog directory it is loading catalog/compose.yml file as expected.

Expected Behaviour: When running any Spring Boot application, from IDE or terminal, the compose.yml should be loaded from the current spring boot application root directory.

Comment From: sivaprasadreddy

When I enable compose support for testing with spring.docker.compose.skip.in-tests=false then surprisingly the tests are expecting the compose.yml file inside module directory.

Upon further investigation, when I check the Run Configuration of CatalogApplication in Intellij IDEA, the Working Directory is by default set to the project root directory. When I change it to $MODULE_WORKING_DIR$ then it is loading the compose.yml file from the module directory only as expected.

Comment From: wilkinsona

when I check the Run Configuration of CatalogApplication in Intellij IDEA, the Working Directory is by default set to the project root directory

Spring Boot uses this working directory to find the file. If the IDE is setting it incorrectly then, unfortunately, there's nothing that we can do about that at runtime. However, I think we can clarify the documentation. It currently states that Spring Boot will "search for a compose.yml and other common compose filenames in your application directory". We should say "working directory" here rather than "application directory".