Skip to content

Files

Latest commit

fb804d8 · May 6, 2020

History

History
53 lines (34 loc) · 963 Bytes

README.MD

File metadata and controls

53 lines (34 loc) · 963 Bytes

Spring Boot JPA practice

Sample project to use spring boot with

  • spring data jpa
  • flyway
  • postgresql
  • h2
  • jib maven plugin

Build the maven project (ensure docker environment is set):

mvn clean package -DskipTests

Run the docker image :

docker run -p 8080:8080 ashutoshsahoo/spring-boot-app

Check application status:

curl 'localhost:8080/api/v1/books' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

The response should be

[{"id":1000,"isbn":"9780596520688","name":"Physics Book name","author":"Ashutosh Sahoo"}]

To run with postgresql(update url, username and password ) :

docker run -p 8080:8080 \
-e spring_datasource_url=jdbc:postgresql://localhost/booksdb \
-e spring_datasource_username=springuser \
-e spring_datasource_password=springuser \
-e spring_flyway_locations=classpath:db/migration/postgresql \
ashutoshsahoo/spring-boot-app