Hi guys,
When using spring-boot-docker-compose together with spring-cloud-starter-bootstrap, during application startup an extra ApplicationPreparedEvent event will be created by Spring Cloud bootstrap. This results in DockerComposeListener processing two events and consequently two instances of DockerComposeLifecycleManager will be created. This is not an issue until the spring.docker.compose.file property is set to the non default value. The issue is that during the bootstrap, DockerComposeProperties is not yet initialised with values defined in application.properties and an error with message No Docker Compose file found in directory will be raised, since the file is not in the default path.
Dependencies:
spring-boot-starter-parent: 3.3.1
spring-cloud-dependencies: 2023.0.2
spring-cloud-starter-bootstrap: 4.1.4
An example application that reproduces the issue can be found here To reproduce the error:
mvn spring-boot:run
A workaround would be to set spring.docker.compose properties in the bootstrap.properties file.
Is this by design or should be fixed somehow?
If you guys have any idea of what is a proper way to fix it, I might be able to contribute in fixing it.
Thanks, Aldo
Comment From: wilkinsona
Duplicates https://github.com/spring-projects/spring-boot/issues/39541.