A Spring Boot application for managing employee leave requests, leave types, and user profiles, with role-based access for Admin and Employee.
- Employee
- Apply, edit, and delete leave requests
- View leave status (Pending, Approved, Rejected)
- Update profile information
- Admin
- Manage employees (Add, Update, Delete)
- Manage leave types (Add, Edit, Delete)
- Approve or reject leave requests
- Security
- Role-based access with Spring Security
- Admin-only and Employee-only endpoints
- Validation
- Leave request status checks
- Only pending leaves can be edited or deleted
- Backend: Java 17, Spring Boot
- Security: Spring Security
- Database: MySQL
- Build Tool: Maven
- IDE Support: IntelliJ IDEA
LeaveManagementSystem/ │ ├─ src/main/java/com/example/LeaveManagementSystem/ │ ├─ Controller/ # REST controllers (AdminController, UserController) │ ├─ Entity/ # JPA entities and DTOs │ ├─ Repository/ # Spring Data JPA repositories │ ├─ Service/ # Business logic │ └─ LeaveManagementSystemApplication.java │ ├─ src/main/resources/ │ ├─ application.properties # Database & Spring configurations │ ├─ pom.xml # Maven build file └─ .gitignore
- Clone the repository
git clone https://github.com/<your-username>/LeaveManagementSystem.git
Import project into your IDE (IntelliJ / Eclipse / VS Code).
Configure database
Create a MySQL database
Update application.properties:
properties
Copy code
spring.datasource.url=jdbc:mysql://localhost:3306/leave_db
spring.datasource.username=root
spring.datasource.password=yourpassword
spring.jpa.hibernate.ddl-auto=update
Run the application
Run LeaveManagementSystemApplication.java
The backend will be available at http://localhost:8080/
API Endpoints
Admin
Endpoint Method Description
/admin/emp/EmpDetails GET List all employees
/admin/emp/AddEmp POST Add a new employee
/admin/emp/UpdateEmp PUT Update employee details
/admin/emp/DeleteEmp/{id} DELETE Delete an employee
/admin/leave/leaveTypes GET List all leave types
/admin/leave/AddLeaveType POST Add a new leave type
/admin/leave/EditLeaveType PUT Edit an existing leave type
/admin/leave/DeleteLeaveType/{id} DELETE Delete a leave type
/admin/leaveRequest/AllRequest GET View all leave requests
/admin/leaveRequest/approve/{id} PUT Approve a leave request
/admin/leaveRequest/reject/{id} PUT Reject a leave request
Employee
Endpoint Method Description
/employee/login GET Login page/message
/employee/updateProfile POST Update employee profile
/employee/applyLeave POST Apply for leave
/employee/viewExistLeave GET View own leave requests
/employee/editLeave/{id} PUT Edit own pending leave
/employee/deleteLeave/{id} DELETE Delete own pending leave
Future Improvements
Frontend integration (React / Angular / Vue)
JWT authentication for stateless security
Email notifications for leave approval/rejection
Reports for employee leave history
Unit & Integration tests for better QA