Skip to content

Sample project with spring boot, spring data jpa, h2, postgresql, flyway and jib maven plugin

Notifications You must be signed in to change notification settings

ashutoshsahoo/spring-data-jpa-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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