You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proof of Concept for a RESTful Web Service built with **Spring Boot 4** targeting **JDK 25 (LTS)**. This project demonstrates best practices for building a layered, testable, and maintainable API implementing CRUD operations for a Players resource (Argentina 2022 FIFA World Cup squad).
11
14
@@ -15,15 +18,15 @@ Proof of Concept for a RESTful Web Service built with **Spring Boot 4** targetin
15
18
-[Tech Stack](#tech-stack)
16
19
-[Project Structure](#project-structure)
17
20
-[Architecture](#architecture)
18
-
-[API Endpoints](#api-endpoints)
21
+
-[API Reference](#api-reference)
19
22
-[Prerequisites](#prerequisites)
20
23
-[Quick Start](#quick-start)
21
24
-[Clone](#clone)
22
25
-[Build](#build)
23
26
-[Run](#run)
24
27
-[Access](#access)
25
28
-[Testing](#testing)
26
-
-[Docker](#docker)
29
+
-[Containers](#containers)
27
30
-[Build and Start](#build-and-start)
28
31
-[Stop](#stop)
29
32
-[Reset Database](#reset-database)
@@ -90,80 +93,121 @@ src/test/java/.../test/
90
93
91
94
## Architecture
92
95
96
+
Layered architecture with dependency injection via Spring Boot's IoC container and constructor injection using Lombok's `@RequiredArgsConstructor`.
classDef test fill:#ccffcc,stroke:#53c45e,stroke-width:2px,color:#555,font-family:monospace;
157
181
158
-
class models,repositories,services,controllers core
182
+
class Application,models,repositories,services,controllers core
159
183
class SpringBoot,SpringDataJPA,SpringCache,SpringValidation feat
160
184
class JakartaPersistence,ProjectLombok,ModelMapper,SpringDoc deps
161
185
class tests test
162
186
```
163
187
164
-
_Figure: Core application flow (blue), supporting features (yellow), external dependencies (red), and test coverage (green). Not all dependencies are shown._
188
+
*Simplified, conceptual view — not all components or dependencies are shown.*
189
+
190
+
### Arrow Semantics
191
+
192
+
Arrows follow the injection direction: `A --> B` means A is injected into B. Solid arrows (`-->`) represent active Spring dependencies — beans wired by the IoC container and invoked at runtime. Dotted arrows (`-.->`) represent test dependencies — test classes reference the types they exercise but are not injected into them.
193
+
194
+
### Composition Root Pattern
195
+
196
+
`Application` is the composition root: `@SpringBootApplication` triggers component scanning that discovers and registers all beans, `@EnableCaching` activates the caching infrastructure, and `@Bean ModelMapper` declares the mapping dependency explicitly. Constructor injection is enforced throughout via Lombok's `@RequiredArgsConstructor` on `final` fields.
197
+
198
+
### Layered Architecture
199
+
200
+
Four layers: Initialization (`Application`), HTTP (`controllers`), Business (`services`), and Data (`repositories`).
201
+
202
+
Spring and third-party packages are placed inside the subgraph of the layer that uses them — co-residency communicates the relationship without extra arrows: `Spring Boot` and `SpringDoc` in Initialization, `Spring Validation` in HTTP, `Spring Cache` and `ModelMapper` in Business, `Spring Data JPA` in Data.
203
+
204
+
`models` and `converters` are cross-cutting: `models` defines the JPA entity and DTOs shared across all layers; `converters` holds the `AttributeConverter` that handles ISO-8601 date serialization for `models`. `Jakarta Persistence` and `Lombok` are their respective dependencies. `Lombok` is also used in `services` and `controllers` via `@RequiredArgsConstructor` and `@Slf4j`, though those arrows are omitted for clarity.
205
+
206
+
### Color Coding
207
+
208
+
Blue = core application packages, yellow = Spring ecosystem, red = third-party libraries, green = tests.
165
209
166
-
## API Endpoints
210
+
## API Reference
167
211
168
212
Interactive API documentation is available via Swagger UI at `http://localhost:9000/swagger/index.html` when the server is running.
169
213
@@ -172,7 +216,7 @@ Interactive API documentation is available via Swagger UI at `http://localhost:9
172
216
-`GET /players` - List all players
173
217
-`GET /players/{id}` - Get player by ID
174
218
-`GET /players/search/league/{league}` - Search players by league
175
-
-`GET /players/search/squadnumber/{squadNumber}` - Get player by squad number
219
+
-`GET /players/squadnumber/{squadNumber}` - Get player by squad number
176
220
-`POST /players` - Create new player
177
221
-`PUT /players/{id}` - Update existing player
178
222
-`DELETE /players/{id}` - Remove player
@@ -257,7 +301,7 @@ open target/site/jacoco/index.html
257
301
258
302
> 💡 **Note:** Dates are stored as ISO-8601 strings for SQLite compatibility. A JPA `AttributeConverter` handles LocalDate ↔ ISO-8601 string conversion transparently. Tests use SQLite in-memory database (jdbc:sqlite::memory:) - the converter works seamlessly with both file-based and in-memory SQLite.
259
303
260
-
## Docker
304
+
## Containers
261
305
262
306
### Build and Start
263
307
@@ -366,4 +410,4 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for det
366
410
367
411
## Legal
368
412
369
-
This project is provided for educational and demonstration purposes and may be used in production environments at your discretion. All referenced trademarks, service marks, product names, company names, and logos are the property of their respective owners and are used solely for identification or illustrative purposes.
413
+
This project is provided for educational and demonstration purposes and may be used in production at your own discretion. All trademarks, service marks, product names, company names, and logos referenced herein are the property of their respective owners and are used solely for identification or illustrative purposes.
0 commit comments