A sample spring boot application to create CRUD API's.Created this application using spring Initializr And implemented Spring security JWT token based authentication.
Technology used
- Spring boot
- Spring Data JPA
- Mysql database
- Spring Security ( JWT token based Authentication)
Description
This application have four entity Employee,Department,User,Roles. And department id is foreign key in Employee table. The relation between Department to Employee is One To Many and between Employee to Department is Many To One.And relation between user and roles is many to many.And This application has two public API : login and user creation. using created User APi, we can create user and using these credential we can login this will generate a JWT token. using this token user can access authorized private API.
Depedency
- Model Mapper : To mapping Dto object to entity or entity to Dto object
- spring-boot-starter-validation : Used to validate entity class property
- lombok : used for getter, setter, constructor, toString()
- mysql-connector-j : used for mysql driver dependency
- spring-boot-devtools: used for live reload , faster application restart
- spring-boot-starter-data-jpa : used for spring data JPA support
- spring-boot-starter-web : used for creating web application
- spring-boot-starter-security: used for Spring Security
- jjwt-api : used for JWT token based Authentication API
- jjwt-impl : used for JWT token based Authentication API implementation class
- jjwt-jackson : used for JWT token based Authentication and handle serialzer exception
version:
- spring boot version is 2.7.11
- JDK version is 17
- MySql version is 8
- JWT version 0.11.5
MySql Database detail:
Port : 9090
username : root
Database name : emp_dept_detail
table : emp,dept
Note: To run this application, Mysql Database should be connected and database 'emp_dept_detail' should be created.