A Spring Boot REST API developed from the "Explorando Padrões de Projetos na Prática com Java" educational project by Digital Innovation One (DIO), taught by Venilton Falvo Jr.
The original project introduces common design patterns and their application with the Spring Framework. This repository was used as a foundation for further study and independent improvements focused on modern API development, validation, exception handling, documentation, testing, and maintainable architecture.
The original educational implementation was progressively refactored and extended with additional practices, including:
- REST API development with Spring Web
- CRUD operations for clients
- Facade pattern applied to the REST controller
- Strategy / Repository pattern through the service and repository layers
- Constructor-based dependency injection
- Bean Validation for request validation
- Custom domain exceptions
- Global exception handling
- Improved service-layer error handling
- ViaCEP integration through Spring Cloud OpenFeign
- OpenAPI / Swagger API documentation
- H2 in-memory database
- Automated integration testing with Spring Boot Test and MockMvc
- Maven build and test verification
- Clean Git history and version control practices
The goal is to use the original project as a foundation for studying modern Spring Boot development, software architecture, REST API design, maintainability, testing, and clean code practices.
The project follows a layered architecture:
Controller
↓
Service
↓
Repository
↓
Database
External address lookup is handled through OpenFeign:
ClienteService
↓
ViaCepService
↓
ViaCEP API
This separation keeps HTTP handling, business logic, persistence, and external integrations organised into dedicated layers.
The main client operations are exposed under /clientes:
| Method | Endpoint | Description |
|---|---|---|
| GET | /clientes |
Lists all clients |
| GET | /clientes/{id} |
Finds a client by ID |
| POST | /clientes |
Creates a new client |
| PUT | /clientes/{id} |
Updates an existing client |
| DELETE | /clientes/{id} |
Removes a client |
The application generates an OpenAPI 3 specification automatically.
When the application is running, the OpenAPI specification is available at:
http://localhost:8080/api-docs
The project also includes Swagger UI for interactive API documentation.
The project includes automated tests using:
- JUnit
- Spring Boot Test
- MockMvc
The test suite verifies application startup and REST API behaviour.
Run the complete test suite with:
.\mvnw.cmd clean testA successful execution should finish with:
BUILD SUCCESS
Clone the repository and navigate to the project directory.
On Windows, run:
.\mvnw.cmd spring-boot:runThe API will be available at:
http://localhost:8080
The project uses an in-memory H2 database for development and testing.
The H2 console is enabled at:
http://localhost:8080/h2-console
Database configuration:
JDBC URL: jdbc:h2:mem:clientesdb
User: sa
Password: [empty]
- Java 11
- Spring Boot 2.5.4
- Spring Data JPA
- Spring Web
- Spring Cloud OpenFeign
- Bean Validation
- OpenAPI / Swagger
- H2 Database
- Maven
- JUnit
- MockMvc
- Git / GitHub
This repository was originally based on the project provided as part of the Digital Innovation One (DIO) learning track:
Explorando Padrões de Projetos na Prática com Java
The original educational material and implementation served as the starting point for this repository. The codebase has since been independently modified, refactored, and extended for learning and portfolio purposes.
PinchiSZ
Software Development | Java | Spring Boot | REST APIs | Cloud & Technology