The Employee Management System is a Spring Boot-based application that provides a RESTful API for managing employee information. It incorporates Spring Security for authentication and authorization, ensuring secure access to various endpoints based on user roles. The project follows a clean and modular architecture, making it easily extensible and maintainable.
Implements Spring Security to control access to API endpoints based on user roles (EMPLOYEE, MANAGER, ADMIN). Provides options for user details management, including in-memory and JDBC configurations.
Utilizes a RESTful API controller (EmployeeRestController
) to perform CRUD operations on employee data. The controller supports the following endpoints:
-
Retrieve All Employees:
- Endpoint:
GET /api/employees
- Description: Retrieves a list of all employees.
- Endpoint:
-
Retrieve Employee by ID:
- Endpoint:
GET /api/employees/{employeeId}
- Description: Retrieves a specific employee by their ID.
- Endpoint:
-
Add New Employee:
- Endpoint:
POST /api/employees
- Description: Adds a new employee to the system.
- Endpoint:
-
Update Employee:
- Endpoint:
PUT /api/employees
- Description: Updates an existing employee's information.
- Endpoint:
-
Delete Employee by ID:
- Endpoint:
DELETE /api/employees/{employeeId}
- Description: Deletes a specific employee by their ID.
- Endpoint:
Employs a service layer (EmployeeService
) to handle business logic related to employee data. The service interacts with a data source (e.g., a database) for CRUD operations.
Implements exception handling, including a custom EmployeeNotFoundException
for scenarios where an employee is not found.
Utilizes Spring Data JPA for easy and efficient data persistence, allowing interaction with a MySQL database. The data model includes an Employee
entity with relevant attributes.
Configured using Maven, ensuring easy project build and management. Dependencies include Spring Boot Starter modules for web, data JPA, security, and MySQL Connector.