The following API allows CRUD operations on a Book bean and returns the response in HTML/Plain text.
- MySQL Server (port 3306)
- Maven
- Java 8
- create database book_db
- modify application.properties and type in user/pass for flyway and db user
- modify pom.xml credentials
- in the root dir execute
- app should be running on localhost:8080/books/
spring.datasource.url = jdbc:mysql://localhost:3306/book_db?useSSL=false
spring.datasource.username = root
spring.datasource.password = Admin123
spring.flyway.url = jdbc:mysql://localhost:3306/mysql
spring.flyway.schemas = book_db
spring.flyway.user = root
spring.flyway.password = Admin123
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.0.7</version>
<configuration>
<url>jdbc:mysql://localhost:3306</url>
<user>root</user>
<password>Admin123</password>
<schemas>
<schema>book_db</schema>
</schemas>
</configuration>
</plugin>
mvn clean package
mvn flyway:migrate
mvn spring-boot:run
Note: you can find here the Postman collection: https://www.dropbox.com/s/pzdk7rcdtnlpnw9/Book%20Operations.postman_collection.json?dl=0