Overview
This is a simple Task Manager application built with Java + Spring Boot. I created it as a way to learn the Spring ecosystem, practice domain-driven design patterns, and understand how Java applications handle persistence, validation, and request/response lifecycles.
Through this project, I gained hands-on experience with Spring Boot project setup, JPA/Hibernate, layered architecture, DTO mapping, and REST API design. It also gave me an opportunity to compare concepts I knew from Python frameworks (Django, FastAPI, SQLAlchemy) with their Java equivalents.
com.example.taskmanager
└─ TaskmanagerApplication.java # Root Spring Boot application
└─ todo/
├─ domain/ # Entities (database models)
│ └─ Todo.java
├─ repo/ # Repository abstraction
│ └─ TodoRepository.java
├─ service/ # Business logic
│ ├─ TodoService.java
│ └─ TodoNotFoundException.java
├─ dto/ # Request/Response objects
│ ├─ CreateTodoRequest.java
│ ├─ UpdateTodoRequest.java
│ └─ TodoResponse.java
├─ mapper/ # Entity ↔ DTO mapping
│ └─ TodoMapper.java
└─ web/ # HTTP controllers & error handling
├─ TodoController.java
└─ ApiErrors.java
Entity / Domain Model
A plain Java object annotated with JPA/Hibernate annotations. Defines the database table structure and constraints (similar to Django models or SQLModel classes).
Repository
Abstraction over persistence. Extends JpaRepository
to provide CRUD operations automatically, without writing SQL. Conceptually similar to Django ORM’s Manager
or SQLAlchemy’s Session
.
Service Layer
Encapsulates business logic. Keeps controllers clean and makes logic reusable across multiple entry points.
DTO (Data Transfer Object)
Defines request/response shapes, keeping them separate from database entities. I used record
classes for immutability and simplicity. JSON ↔ Java conversion is handled by Jackson, while Jakarta annotations add validation constraints.
Mapper
Converts between DTOs and Entities. This ensures a clear separation between the API layer and persistence layer.
Controller
Handles HTTP requests and maps them to service calls. Functions like Django’s views.py
or FastAPI’s decorated route functions.