# asitha123/java-spring-boot-student-management-system architecture

> Architecture diagram of the GitHub repository asitha123/java-spring-boot-student-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/asitha123/java-spring-boot-student-management-system
- Repository: https://github.com/asitha123/java-spring-boot-student-management-system

## Overview

##### Project Type & Purpose
- The project is a web-based student management system built with Java and Maven.
- It uses Spring Boot (as noted in the title) for application configuration and runs on an embedded server.
- The system manages entities such as students, meetings, rooms and leverages MongoDB as its database.

##### File Structure
- The project follows a Maven standard directory layout with a clear separation between source code (src/main/java) and test code (src/test).
- There’s a layered architecture evident from the package structure:
- The “controller” package contains web controllers (e.g., TemplateController) that handle client requests.
- The “service” package (with its interfaces and implementations) handles business logic.
- The “dao” packages (with generic implementations) interact with the persistence layer.
- The “model” packages define the domain entities (Student, Room, Meeting).
- The “common” package holds shared components such as exception handling, messages, and even server-sent event (SSE) functionality.
- There are configuration files (e.g., AppConfiguration.java) and resource configurations (application.yml, _logback.xml) supporting system setup.
- The WEB-INF/jsp directory under the webapp folder indicates that JSP views form the UI.

##### Key Components & Their Relationships
a. Presentation Layer:
- Components: JSP pages (list.jsp, save.jsp), TemplateController.
- Role: Handles user interaction and presentation.
b. Controller Layer:
- Role: The controllers receive client requests, call the service layer, and return view responses.
c. Service Layer:
- Components: StudentService, MeetingService, RoomService, and their respective implementations.
- Role: Contains business logic, orchestrates calls between controllers and DAOs.
d. Data Access Layer:
- Components: DAO interfaces and implementations for students, meetings, and rooms.
- Role: Manages CRUD operations and directly interacts with the MongoDB database.
e. Domain Model:
- Components: The model classes (Student, Room, Meeting) that represent the core data objects.
f. Common Components:
- Components: Common utilities such as generic DAO support, exception classes, response models, messages, and SSE event handling.
g. External Services:
- MongoDB: As the primary database.

##### Important Architectural Patterns & Design Principles
- Layered Architecture: Moves from Controllers to Services to DAOs to Models.
- Separation of Concerns: Each layer has clearly defined responsibilities.
- Reusability and Extendability: The “common” packages (generic DAO, services, exception handling) support code reuse across different modules.
- Event-Driven Updates: Inclusion of server-sent event (SSE) components suggests some asynchronous event handling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["JSP Views"]
    end
    click UI "https://github.com/asitha123/java-spring-boot-student-management-system/tree/master/student-management-system/src/main/webapp/WEB-INF/jsp"

    %% Controller Layer
    subgraph "Controller Layer"
        CT["TemplateController"]
    end
    click CT "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/controller/TemplateController.java"

    %% Service Layer
    subgraph "Service Layer"
        subgraph "Student Service"
            SS_I["StudentService (Interface)"]
            SS_Impl["StudentServiceImpl (Implementation)"]
        end
        click SS_I "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/service/StudentService.java"
        click SS_Impl "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/service/impl/StudentServiceImpl.java"
        
        subgraph "Meeting Service"
            MS_I["MeetingService (Interface)"]
            MS_Impl["MeetingServiceImpl (Implementation)"]
        end
        click MS_I "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/service/MeetingService.java"
        click MS_Impl "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/service/impl/MeetingServiceImpl.java"
        
        subgraph "Room Service"
            RS_I["RoomService (Interface)"]
            RS_Impl["RoomServiceImpl (Implementation)"]
        end
        click RS_I "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/service/RoomService.java"
        click RS_Impl "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/service/impl/RoomServiceImpl.java"
    end

    %% DAO Layer
    subgraph "DAO Layer"
        subgraph "Student DAO"
            SDA_I["StudentDao (Interface)"]
            SDA_Impl["StudentDaoImpl (Implementation)"]
        end
        click SDA_I "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/dao/StudentDao.java"
        click SDA_Impl "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/dao/impl/StudentDaoImpl.java"
        
        subgraph "Meeting DAO"
            MDA_I["MeetingDao (Interface)"]
            MDA_Impl["MeetingDaoImpl (Implementation)"]
        end
        click MDA_I "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/dao/MeetingDao.java"
        click MDA_Impl "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/dao/impl/MeetingDaoImpl.java"
        
        subgraph "Room DAO"
            RDA_I["RoomDao (Interface)"]
            RDA_Impl["RoomDaoImpl (Implementation)"]
        end
        click RDA_I "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/dao/RoomDao.java"
        click RDA_Impl "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/dao/impl/RoomDaoImpl.java"
    end

    %% Domain Model
    subgraph "Domain Model"
        DM["Domain Models: Student, Room, Meeting"]
    end
    click DM "https://github.com/asitha123/java-spring-boot-student-management-system/tree/master/student-management-system/src/main/java/com/studentmgr/model"

    %% Common Components
    subgraph "Common Components"
        GC["Generic DAO Support"]
        EH["Exception Handling"]
        MSG["Messaging"]
        CR["Common Response"]
        SSE["SSE Components"]
    end
    click GC "https://github.com/asitha123/java-spring-boot-student-management-system/tree/master/student-management-system/src/main/java/com/studentmgr/common/dao"
    click EH "https://github.com/asitha123/java-spring-boot-student-management-system/tree/master/student-management-system/src/main/java/com/studentmgr/common/exception"
    click MSG "https://github.com/asitha123/java-spring-boot-student-management-system/tree/master/student-management-system/src/main/java/com/studentmgr/common/messages"
    click CR "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/common/response/CommonResponse.java"
    click SSE "https://github.com/asitha123/java-spring-boot-student-management-system/tree/master/student-management-system/src/main/java/com/studentmgr/common/sse"

    %% Configuration
    subgraph "Configuration"
        AC["AppConfiguration"]
        SR["SetupRoom"]
    end
    click AC "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/config/AppConfiguration.java"
    click SR "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/java/com/studentmgr/config/SetupRoom.java"

    %% External Database
    subgraph "External Database"
        DB(["MongoDB"])
    end
    click DB "https://github.com/asitha123/java-spring-boot-student-management-system/blob/master/student-management-system/src/main/resources/application.yml"

    %% Connections between layers
    UI -->|"triggers"| CT
    CT -->|"calls"| SS_I
    CT -->|"calls"| MS_I
    CT -->|"calls"| RS_I

    %% Service layer internal connections
    SS_I -->|"implements"| SS_Impl
    MS_I -->|"implements"| MS_Impl
    RS_I -->|"implements"| RS_Impl

    %% Service to DAO connections
    SS_Impl -->|"uses"| SDA_Impl
    MS_Impl -->|"uses"| MDA_Impl
    RS_Impl -->|"uses"| RDA_Impl

    %% DAO to Database connections
    SDA_Impl -->|"CRUD"| DB
    MDA_Impl -->|"CRUD"| DB
    RDA_Impl -->|"CRUD"| DB

    %% Services and DAOs interacting with Domain Models
    SS_Impl -->|"manages"| DM
    MS_Impl -->|"manages"| DM
    RS_Impl -->|"manages"| DM
    SDA_Impl -->|"maps"| DM
    MDA_Impl -->|"maps"| DM
    RDA_Impl -->|"maps"| DM

    %% DAO layer common support
    SDA_Impl -->|"extends"| GC
    MDA_Impl -->|"extends"| GC
    RDA_Impl -->|"extends"| GC

    %% Service layer common components usage
    SS_Impl -->|"handles"| EH
    MS_Impl -->|"handles"| EH
    RS_Impl -->|"handles"| EH

    SS_Impl -->|"notifies"| MSG
    MS_Impl -->|"notifies"| MSG
    RS_Impl -->|"notifies"| MSG

    SS_Impl -->|"triggers"| SSE
    MS_Impl -->|"triggers"| SSE
    RS_Impl -->|"triggers"| SSE

    %% Configuration influences
    AC -->|"configures"| CT
    AC -->|"configures"| SS_Impl
    AC -->|"configures"| SDA_Impl
    SR -->|"setsUp"| DB

    %% Styling
    class UI frontend;
    class CT controller;
    class SS_I,SS_Impl,MS_I,MS_Impl,RS_I,RS_Impl service;
    class SDA_I,SDA_Impl,MDA_I,MDA_Impl,RDA_I,RDA_Impl dao;
    class DM domain;
    class GC,EH,MSG,CR,SSE common;
    class AC,SR config;
    class DB database;
```
