From 1e2fbb97b03a53e7f35ceee57047b7a2cf95a2d6 Mon Sep 17 00:00:00 2001 From: Frank Migliorino Date: Tue, 24 Sep 2019 10:15:18 -0400 Subject: [PATCH] fix docs for setting profiles Add using -Dspring-boot.run.jvmArguments to the notes for how to set up using MySQL. --- .../resources/db/mysql/petclinic_db_setup_mysql.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt b/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt index 920906687..e2a20fe6f 100644 --- a/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt +++ b/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt @@ -23,7 +23,15 @@ 3) Run the app with `spring.profiles.active=mysql` (e.g. as a System property via the command line, but any way that sets that property in a Spring Boot app should work). + +4) For newer versions of Spring Boot, those will fork the JVM that executes the webserver, + which means properties on the command line are lost. You can use: + + mvn spring-boot:run\ + -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=mysql -Dspring.datasource.initialization-mode=always" + + To set profiles & properties. N.B. the "petclinic" database has to exist for the app to work with the JDBC URL value as it is configured by default. This condition is taken care of by the docker-compose -configuration provided, or by the `schema.sql` if you can run that as root. \ No newline at end of file +configuration provided, or by the `schema.sql` if you can run that as root.