spring-projects / spring-petclinic

A sample Spring-based application
Apache License 2.0
7.79k stars 23.98k forks source link

Utilize active profiles with the help of spring.docker.compose.profiles.active property #1638

Closed kgromov closed 3 months ago

kgromov commented 3 months ago

In order to avoid manual docker-compose run spring-boot-docker-compose scope was extended and spring.docker.compose.profiles.active set to accept active profile(s).

So after changes it's possible to run petclinic app just with:

 ./mvnw spring-boot:run "-Dspring-boot.run.arguments=--spring.profiles.active=postgres"

or with IDE adding corresponsding profile. and let spring-docker-compose automatically start up.

@pivotal-cla This is an Obvious Fix

dsyer commented 3 months ago

You can get the same behaviour with no changes if you run it as ./mvnw spring-boot:test-run -Dspring-boot.run.main-class=org.springframework.samples.petclinic.PostgresIntegrationTests. I'm happy to add more notes to the README if you think that would help, or we could add a Maven profile, but I'm not keen on putting docker-compose in the production runtime classpath.

kgromov commented 3 months ago

A bit reluctant, but agree - there is way around.

but I'm not keen on putting docker-compose in the production runtime classpath.

BTW was thinking it's fine for sample app