A Spring Boot application for managing employees with polymorphic entities like PermanentEmployee
and ContractEmployee
. The application demonstrates CRUD operations, utilizes Hibernate/JPA for database interactions, and follows industry-standard coding practices.
Ensure you have the following installed:
- Java JDK: Version 17 or higher.
- Maven: Dependency and build management.
- MySQL: Relational database.
git clone https://github.com/abhishekgoyalp/Employee-Management-System.git
cd Employee-Management-System
Open the src/main/resources/application.properties
file and update it with your database configuration.
spring.datasource.url=jdbc:mysql://localhost:3306/your_db
spring.datasource.username=your_db_username
spring.datasource.password=your_db_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Run the following command to build the project:
mvn clean install
By default, It will run on localhost with port 8080. If you want to run it on another port just add one property(server.port=your_port
) in application.properties
file. Start the application with:
mvn spring-boot:run
Run unit tests with:
mvn test
Method | Endpoint | Description |
---|---|---|
POST | /api/employees |
Create a new employee |
GET | /api/employees/{id} |
Get an employee by ID |
PUT | /api/employees/{id} |
Update an existing employee |
DELETE | /api/employees/{id} |
Delete an employee |
GET | /api/employees |
Get all employees |
- CRUD Operations: Create, Read, Update, and Delete employees.
- Polymorphism: Handle multiple employee types (
PermanentEmployee
andContractEmployee
). - Database Interaction: Uses MySQL with Hibernate ORM.
- Unit Tests: JUnit-based test cases for validation and business logic.