How hilalinabil/spring_prjt works
Project type and purpose
• This is a single-module Spring Boot backend service exposing REST APIs for managing Task and TaskList entities.
• There is no frontend in this repo; clients will call the API (e.g., via Postman or a separate UI).
High-level layers
• Presentation layer: package controllers
• Service layer: package services + services.impl
• Data-access layer: package repositories
• Mapping layer: package mappers + mappers.impl
• Domain/model: package domain (entities & DTOs)
• Infrastructure: application.properties + external database (Docker Postgres/MySQL) + H2 for tests
Main components
a. External Client
• Represents any HTTP consumer (Postman, frontend app).
b. API Gateway / Controllers
• TaskController, TaskListController
• GlobalExceptionHandler for error responses.
c. DTO / Mapper Layer
• TaskDto, TaskListDto, ErrorResponse
• TaskMapper/TaskListMapper and their Impl classes.
d. Service Layer
• TaskService & TaskServiceImpl
• TaskListService & TaskListServiceImpl
e. Repository Layer
• TaskRepository, TaskListRepository (Spring Data JPA interfaces)
f. Database
• Primary DB (e.g., Postgres/MySQL in Docker)
• Test DB (H2 in-memory for unit tests)
Relationships and data flow
• Controllers → Service Layer (calls business methods)
• Service Layer → Repositories (CRUD operations)
• Repository Layer ↔ Database (SQL queries)
• Controllers ↔ GlobalExceptionHandler (error flow)
• Service/Controller ↔ Mapper Layer (entity ⇄ DTO conversions)
Architectural patterns
• Layered (aka “Onion” or “Hexagonal” without strict ports/adapters)
• Dependency Injection (Spring-managed beans)
• Use of DTOs and Mappers decouples domain entities from API contracts
• Repository pattern via Spring Data JPA
Deployment context
• Spring Boot jar running in an application server or container.
• External DB container.