diff --git a/spring-petclinic/README.md b/spring-petclinic/README.md index 4223058..f20bdaa 100644 --- a/spring-petclinic/README.md +++ b/spring-petclinic/README.md @@ -44,8 +44,9 @@ Prerequisites For Binary: 2. OpenJDK 17.0.9 3. MVN version 3.6.3 -## Setup the backend +# Setup the backend +## Using Postgres as the database You need to update the postgresql properties, go to `spring-petclinic/spring-petclinic-rest/src/main/resources/application-postgresql.properties` and change @@ -65,12 +66,44 @@ and then build the jar using: mvn clean install -Dmaven.test.skip=true ``` -## Spin up the database +#### Spin up the database ``` docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 --name mypostgres postgres:15.2 ``` +## Using MySQL as the database +You need to update the properties file , go to +`spring-petclinic/spring-petclinic-rest/src/main/resources/application.properties` +and make active profile as mysql - +``` +spring.profiles.active=mysql,spring-data-jpa +``` +Inside the `src/main/resources/application-mysql.properties` change the url to +``` +spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false&allowPublicKeyRetrieval=true +``` +and then build the jar using: + +``` +mvn clean install -Dmaven.test.skip=true +``` +: +#### Spin up the MySQL database + +``` +docker run command - docker run -e MYSQL_USER=mysql -e MYSQL_PASSWORD=123456 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=testdb -p 3306:3306 --rm mysql:latest +``` + +### Some limitations currently in mysql parser - + +1) Please note that SSL is currently not supported in the MySQL integration. To use the package without SSL, you can include the following parameters in your database URL like the following example - +``` +spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false&allowPublicKeyRetrieval=true +``` + +2) Currently best experience for using MySQL support of keploy is to use default settings which where + ## Recording the testcases with Keploy ``` diff --git a/spring-petclinic/spring-petclinic-rest/src/main/resources/application-mysql.properties b/spring-petclinic/spring-petclinic-rest/src/main/resources/application-mysql.properties index daffa4a..1aea494 100644 --- a/spring-petclinic/spring-petclinic-rest/src/main/resources/application-mysql.properties +++ b/spring-petclinic/spring-petclinic-rest/src/main/resources/application-mysql.properties @@ -5,12 +5,14 @@ # MySQL config start #---------------------------------------------------------------- -spring.datasource.url = jdbc:mysql://localhost:3306/petclinic?useUnicode=true -spring.datasource.username=pc -spring.datasource.password=petclinic -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.jpa.database=MYSQL -spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect -spring.jpa.hibernate.ddl-auto=none + +spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false&allowPublicKeyRetrieval=true +spring.datasource.username=root +spring.datasource.password=123456 + +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect +spring.jpa.hibernate.ddl-auto=update #---------------------------------------------------------------- # MySQL config end + +# docker run command - docker run -e MYSQL_USER=mysql -e MYSQL_PASSWORD=123456 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=testdb -p 3306:3306 --rm mysql:latest \ No newline at end of file