A simple Spring Core + Maven based Java application that generates an employee salary slip using dependency injection and annotation-based configuration. This project demonstrates how to use Springβs IoC container, annotation-driven configuration, and basic business logic to compute salary details like gross salary, tax deductions, and net salary.
The application works by creating an Employee bean, injecting it into a SalarySlipService, and then calculating the salary breakdown using simple formulas. It uses Spring annotations like @Configuration, @ComponentScan, @Component, @Service, and @Autowired to manage dependencies automatically.
Tech Stack: Java (JDK 8+), Spring Core (Annotation-based), Maven, any IDE like IntelliJ or Eclipse.
Project Structure (simplified): com.nit βββ config β AppConfig.java βββ main β TestApp.java βββ sbeans β Employee.java, SalarySlipService.java βββ meaven_Project01.Employee_Salary_Slip_Generator β App.java
Key Files:
AppConfig.java (Spring Configuration)
Employee.java (Bean class holding employee data like id, name, salary, HRA, DA, tax percentage)
SalarySlipService.java (Business logic for salary calculation: gross = basic + HRA + DA, tax = percentage of gross, net = gross - tax)
TestApp.java (Main class that loads Spring context, sets employee data, and triggers salary generation)
How to Run:
-
Clone the repository git clone https://github.com/Maven_Project01/employee-salary-slip.git
-
Navigate to the project folder cd employee-salary-slip
-
Build using Maven mvn clean install
-
Run TestApp.java from your IDE
Sample Output:
Salary Slip for Raj Gross Salary: 47700.0 Tax Deducted: 7632.0 Net Salary: 40068.0
Learning Outcomes: Understanding Spring IoC container, dependency injection, annotation-based configuration, and clean separation between data (Employee) and business logic (SalarySlipService).
Future Improvements: Convert to Spring Boot REST API, add database integration, support multiple employees, export salary slip as PDF.
Author: Durgesh Tiwari (Student, learning Java and Spring)
License: Free to use for educational purposes.