The Student-Course-Teacher Management System is a comprehensive web application built with Spring Boot that facilitates the management of educational processes in an institution. The system provides a user-friendly interface for managing students, courses, teachers, and their relationships.
- Simple login and registration system
- Role-based user management (Student, Teacher, Admin)
- Session management using HttpSession
- Add, view, edit, and delete student information
- Enroll students in courses
- View enrolled courses for each student
- Create, view, edit, and delete courses
- Assign teachers to courses
- Enroll students in courses
- View course details with enrolled students and assigned teacher
- Add, view, edit, and delete teacher information
- Assign courses to teachers
- View assigned courses for each teacher
- Java 21
- Spring Boot 3.1.5
- Spring MVC
- Spring Data JPA
- Hibernate
- JSP (JavaServer Pages)
- Bootstrap 5
- Font Awesome
- PostgreSQL
- Maven
- Flyway (Database Migration)
- Lombok (Reducing boilerplate code)
- JUnit 5 (Testing)
- Mockito (Testing)
- Has many-to-many relationship with Course (enrolledCourses)
- Has many-to-one relationship with Teacher
- Has many-to-many relationship with Student
- Has one-to-many relationship with Course
- Represents system users with roles (STUDENT, TEACHER, ADMIN)
- Connected to Student/Teacher entities based on role
- Java 21 or higher
- Maven
- PostgreSQL
- Create a PostgreSQL database named
schooldb - Update database credentials in
application.propertiesif needed
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd student-course-teacher-management -
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
-
Access the application at:
http://localhost:8080
- Username: admin
- Password: admin123
- Navigate to the registration page
- Fill in the required information
- Select a role (Student or Teacher)
- Submit the form
- Navigate to the Students section
- Add new students or edit existing ones
- View student details to manage course enrollments
- Navigate to the Courses section
- Add new courses or edit existing ones
- Assign teachers and enroll students through the course details page
- Navigate to the Teachers section
- Add new teachers or edit existing ones
- Assign courses through the teacher details page
The application includes a comprehensive error handling system:
- 404 (Not Found): Displayed when a resource is not found or when accessing invalid IDs
- 403 (Forbidden): Displayed when access to a resource is denied
- 400 (Bad Request): Displayed when form validation fails
- 500 (Internal Server Error): Displayed when an unexpected server error occurs
- General error page: Displayed for other types of errors
The application uses Spring's @ControllerAdvice to handle exceptions globally:
IllegalArgumentException: Returns a 404 Not Found status code (used for non-existent resources)BindException: Returns a 400 Bad Request status code (used for validation errors)- Other exceptions: Returns a 500 Internal Server Error status code
This ensures that appropriate HTTP status codes are returned to the client instead of generic 500 errors.
For development and testing purposes, you can use the following endpoints:
/test-error/404: Triggers a 404 Not Found error/test-error/403: Triggers a 403 Forbidden error/test-error/500: Triggers a 500 Internal Server Error/test-error/error: Triggers a generic error/test-error/validation: Tests form validation error handling
Note: These test endpoints should be disabled or removed in production.
The application includes comprehensive tests for repositories, services, and controllers.
Run tests using:
mvn testsrc/
βββ main/
β βββ java/
β β βββ com/
β β βββ softserve/
β β βββ academy/
β β βββ controller/ # MVC Controllers
β β βββ dto/ # Data Transfer Objects
β β βββ mapper/ # Entity-DTO Mappers
β β βββ model/ # JPA Entities
β β βββ repository/ # Spring Data Repositories
β β βββ service/ # Business Logic Services
β β βββ Application.java # Main Application Class
β βββ resources/
β β βββ db/
β β β βββ migration/ # Flyway Database Migrations
β β βββ application.properties # Application Configuration
β βββ webapp/
β βββ WEB-INF/
β βββ views/ # JSP Views
βββ test/
βββ java/ # Test Classes
βββ resources/ # Test Configuration