Skip to content

Latest commit

 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

school-console-app (Spring Boot Edition)

This console application is designed to ease the routine of everyday school administration.
One can maintain student records, student assignments to groups, and course enrollments easily in one place.
Moreover, the system provides an easy search and filtering of information, hence making data management easier.


Project Overview

User Features

  • Student Management: Helps to make CRUD operations on students.
  • Groups & Courses: They are responsible for handling groups and courses.
  • Data Filtering: Searching for groups by student number and filtering students by course name.

Technical Specification

  • Stack: Spring Boot 3.x, Spring Data JPA (Hibernate), Flyway, PostgreSQL, Testcontainers.
  • Architecture: Migrate from manual dependency management to Spring IoC container.

How It's Made

It has Spring Boot for auto-configuration. that helps to enable autocinfigurations, component scanning and configuration annotations

0) Main & Bootstrapping

  • Main: The @SpringBootApplication annotation that helps to enable autocinfigurations, component scanning and configuration annotations
  • Runners (StartupRunner, FacadeRunner): Implement CommandLineRunner in order to run logic (migrations, data seeding, menu) rwhen context has already started.

1) Database Migration (Flyway)

  • Flyway: tool that helps to update a database from one version to the next using migrations.

2) Persistence Layer (JPA / Hibernate)

  • Entities: The @Entity and @Table annotations map Java classes to database tables, enabling JPA/Hibernate to handle Object-Relational Mapping (ORM) automatically. The @Id and @GeneratedValue annotations are used to manage the primary key on the database side.
  • JPA DAOs: Use EntityManager and @Repository for Object-Relational Mapping (ORM) to remove dependence on hard-coded queries.

3) Service Layer & Dependency Injection

  • Spring IoC: Classes annotated with @Service or @Component are treated as "beans" by Spring.
  • Constructor Injection: Spring automatically injects the dependencies into the constructor of the classes.
    This promotes testability and immutable objects.
  • SchoolDataFacade: Orchestrates generators and services, encapsulating complex business logic from the UI layer.

4) Data Generation

  • Generators: These are special components responsible for automatically populating students, groups, and enrollments randomly in the database during initial runtime.

Quality Assurance & Testing

Testcontainers

  • Real DB Testing: Spins up a real PostgreSQL in a Docker container at test time for environment parity.
  • @ServiceConnection: Automatically configures Spring Boot connection details for the containerised database.

Testing Tools

  • JUnit 5 & Mockito: Used for unit testing business logic and verifying component interactions.
  • HikariCP: The default connection pool library, automatically included via spring-boot-starter-data-jpa.
  • @DataJpaTest: Provides a specialized environment for fast, isolated testing of the persistence layer.

Resources

  1. application.yaml: Central configuration for database connection, logging, and Hibernate settings.
  2. db/migration: Versioned SQL migration scripts managed by Flyway.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages