A full-stack web application for managing student records, built with Spring Boot, Spring Security, Thymeleaf, and MySQL. Supports role-based access control (Student, Teacher, Admin), fuzzy search, and automated database backup.
- User Authentication & Authorization
- Login / Register with Spring Security
- BCrypt password encoding
- Role-based access:
ROLE_STUDENT: view onlyROLE_TEACHER: create, edit, delete studentsROLE_ADMIN: full control
- Student CRUD
- Add, edit, delete, list students
- Fuzzy search by name or surname
- Responsive Web UI
- Thymeleaf templates with dynamic role-based button rendering
- Unit Testing
- Controller tests with
@WebMvcTest,MockMvc,@WithMockUser - Service layer tests with Mockito
- Controller tests with
- Database Backup Script
- Bash script
backup.shto dump MySQL database, compress, and clean old backups - Supports
~/.my.cnffor passwordless execution
- Bash script
- Java 17
- Spring Boot 3.2.3
- Spring Security 6
- Spring Data JPA (Hibernate)
- Thymeleaf + Bootstrap (custom CSS)
- MySQL 8
- Maven
- JUnit 5 + Mockito
- Git / GitHub
- Java 17
- MySQL 8 running locally
- Maven (or use the included Maven wrapper)
- Clone the repository
git clone https://github.com/kitty1314/Springboot_Student_System.git cd Springboot_Student_System - Create a MySQL database (e.g. student_db) Configure database connection
- Copy src/main/resources/application-template.properties to application.properties and fill in your own username/password.
- Build and run
./mvnw spring-boot:run| Username | Password | Role |
|---|---|---|
| admin | 123456 | ROLE_ADMIN |
| studentA | 123456 | ROLE_STUDENT |
| teacher | 123456 | ROLE_TEACHER |
You can register new users via /register.
A Bash script backup.sh is provided to dump the student_db database.
Usage: ./backup.sh Configuration: To avoid storing passwords in the script, create a ~/.my.cnf file:
[client]
user=root
password=your_mysql_passwordThen set permissions: chmod 600 ~/.my.cnf The script creates timestamped .sql files in ./backups/, compresses them, and deletes backups older than 7 days.
Run unit tests:
./mvnw testProject Structure
src/
├── main/
│ ├── java/.../studentsystemapp/
│ │ ├── config/ # SecurityConfig
│ │ ├── controller/ # MVC controllers
│ │ ├── entity/ # JPA entities (User, Student)
│ │ ├── repository/ # JPA repositories
│ │ └── service/ # CustomUserDetailsService
│ └── resources/
│ ├── templates/ # Thymeleaf HTML files
│ └── application.properties
└── test/ # Unit tests
License
This project is for educational purposes.