Skip to content

Spring Boot application with - Flyway migration, JWT authentication, Hibernate Envers Auditing, Hazelcast distributed caching, Docker Compose support. Checkout different releases for all features added to this application - https://github.com/chatterjeesunit/spring-boot-app/releases

Notifications You must be signed in to change notification settings

dapengBAO/spring-boot-app

 
 

Repository files navigation

Sample Spring Boot project

Releases

For more detailed step by step guide on how to build this app, please refer to the blogs on - http://sunitc.dev/tag/spring-boot/

How to run it

  • Pre-requisite (for first time run only)
    Create a folder for mysql volume mount
    mkdir -p ~/data/mysql8

  • Build
    ./gradlew clean build

  • Run via Docker Compose
    docker-compose up -d --build --scale application=2

Creating Dummy Data

  • Run SQL Script - scripts/Create_Dummy_Data.sql

Default Users for Login

Username Password ROLE
[email protected] admin01@123# ADMIN
[email protected] admin02@123# ADMIN
[email protected] welcome@123# USER

Sample APIS

1. API to get JWT Auth Token
curl --location --request POST 'localhost/api/v1/auth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "userName": "[email protected]",
    "password": "admin01@123#"
}'
2. API to get all customers (paginated)
curl --location --request GET 'dev-sandbox/api/v1/customer/?pageNum=0&pageSize=10' \
--header 'Authorization: Bearer <<REPLACE JWT TOKEN HERE>>'

In above code, replace the text <<REPLACE JWT TOKEN HERE>> with JWT token from Auth API

Troubleshooting

  • If after running Docker Compose, you are getting 404 on the APIs, ONLY restart the load-balancer. Sometimes this happens when loadbalancer starts before application server starts

To-Do

  • Add a wait-for script in Docker compose for following container dependencies
    • Loadbalancer - Depends on - Application
    • Application - Depends on - Database

About

Spring Boot application with - Flyway migration, JWT authentication, Hibernate Envers Auditing, Hazelcast distributed caching, Docker Compose support. Checkout different releases for all features added to this application - https://github.com/chatterjeesunit/spring-boot-app/releases

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%