upgrade Mysql.Properties and petclinic_db_Setup

This commit is contained in:
AewInformatica 2019-11-24 14:31:56 -03:00
parent 9fa7f677d6
commit 8c9a33000c
2 changed files with 13 additions and 5 deletions

View file

@ -1,7 +1,7 @@
# database init, supports mysql too # database init, supports mysql too
database=mysql database=mysql
spring.datasource.url=jdbc:mysql://localhost/petclinic spring.datasource.url=${MYSQL_DB:jdbc:mysql://localhost/petclinic}
spring.datasource.username=root spring.datasource.username=${MYSQL_USER:petclinic@petclinicdb2}
spring.datasource.password=petclinic spring.datasource.password=${MYSQL_PASS:petclinic}
# SQL is written to be idempotent so this is safe # Uncomment this the first time the app runs
spring.datasource.initialization-mode=always spring.datasource.initialization-mode=always

View file

@ -23,6 +23,14 @@
3) Run the app with `spring.profiles.active=mysql` (e.g. as a System property via the command 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). 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 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 as it is configured by default. This condition is taken care of by the docker-compose