mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 23:05:50 +00:00
upgrade Mysql.Properties and petclinic_db_Setup
This commit is contained in:
parent
9fa7f677d6
commit
8c9a33000c
2 changed files with 13 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
# database init, supports mysql too
|
||||
database=mysql
|
||||
spring.datasource.url=jdbc:mysql://localhost/petclinic
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=petclinic
|
||||
# SQL is written to be idempotent so this is safe
|
||||
spring.datasource.initialization-mode=always
|
||||
spring.datasource.url=${MYSQL_DB:jdbc:mysql://localhost/petclinic}
|
||||
spring.datasource.username=${MYSQL_USER:petclinic@petclinicdb2}
|
||||
spring.datasource.password=${MYSQL_PASS:petclinic}
|
||||
# Uncomment this the first time the app runs
|
||||
spring.datasource.initialization-mode=always
|
|
@ -23,6 +23,14 @@
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue