Member-only story
Simple Package Structure for Spring Boot REST API — Video Tutorial
Published in
Aug 6, 2023
An opinionated package structure for a relatively simple REST API applications with Spring Boot
What are we building?
Example REST Endpoint — PingPong API
Assumptions:
- You have some models to store and fetch from storage.
- There is some business logic involved before saving an object.
Why even bother with a structure?
- Not over-complicated, but also not everything in one file.
- Easier to navigate.
- Paving the road for future extensions.
What’s inside?
- Only three layers.
- At a minimum, only one model conversion — Entity to DTO.
Advantages
- It is elementary to get started.
- Possibility to extend. For example, input validation can be done directly on the DTOs or by introducing Request and Response models at the top layer.
Initially posted via CoderVlogger.com.