A production-style RESTful backend application built using Spring Boot and MySQL implementing full CRUD operations with layered architecture, validation, and global exception handling.
- Java 17+
- Spring Boot
- Spring Data JPA (Hibernate)
- MySQL
- Maven
- Postman (API Testing)
Layered architecture following best practices:
- Controller Layer
- Service Layer
- Repository Layer
- Model (Entity)
- Global Exception Handling
- Validation
- Create Employee
- Get All Employees
- Get Employee by ID
- Update Employee
- Delete Employee
- Field Validation
- Custom 404 Error Handling
- Proper HTTP Status Codes
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/employees | Create employee |
| GET | /api/employees | Get all employees |
| GET | /api/employees/{id} | Get employee by ID |
| PUT | /api/employees/{id} | Update employee |
| DELETE | /api/employees/{id} | Delete employee |
{
"name": "Raghav",
"email": "raghav@example.com",
"department": "IT",
"salary": 50000
}❌ Sample Validation Error
{
"email": "Email should be valid",
"salary": "Salary must be positive"
}👨💻 Author Raghav Maheshwari