- with few basic CRUD REST APIs - Git Tag V1.1
- with Flyway integration for Database migration - Git Tag V2.0
- with Basic Authentication/Authorization - Git Tag V3.0
- with Hibernate Envers/JPA Auditing - Git Tag V4.0
- with Authentication using JWT - Git Tag V5.0
- with Caffeine Caching - Git Tag V6.0
- with Docker Compose - Git Tag V7.0
- with Distributed Cache using Hazelcast - Git Tag V8.0
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/
-
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
- Run SQL Script -
scripts/Create_Dummy_Data.sql
Username | Password | ROLE |
---|---|---|
[email protected] | admin01@123# | ADMIN |
[email protected] | admin02@123# | ADMIN |
[email protected] | welcome@123# | USER |
curl --location --request POST 'localhost/api/v1/auth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"userName": "[email protected]",
"password": "admin01@123#"
}'
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
- 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
- Add a wait-for script in Docker compose for following container dependencies
- Loadbalancer - Depends on - Application
- Application - Depends on - Database