How samuel-cruz/desafio works
Project type and purpose
• This is a standalone back-end REST API built with Java 11 and Spring Boot.
• Its sole responsibility is to manage “Pessoa” (person) records: create, read, update, delete, with field validation and API versioning (v1/v2).
High-level architecture
• Client (e.g. front-end app or Swagger UI)
• Issues HTTP requests to the API endpoints.
• API Layer (Spring MVC Controllers)
• Versioned controllers under br.com.meta.controller.v1 and v2.
• They accept requests, invoke converters and services, and return DTOs.
• Conversion Layer
• BaseConverter + versioned converters transform between Entity ↔ DTO.
• Service Layer
• BaseService + PessoaService encapsulate business rules (validations, uniqueness checks).
• Repository Layer
• BaseRepository + PessoaRepository handle CRUD via Spring Data JPA.
• Persistence
• H2 in-memory (or file-based) database holds Pessoa table.
• Cross-cutting concerns
• Exception handling (CustomizedResponseEntityExceptionHandler)
• SecurityConfig (authentication/authorization if enabled)
• SwaggerConfig exposes API docs
• BaseWebMvcConfig for MVC customization
• Deployment
• Packaged via Maven, containerized with Dockerfile.
Relationships and data flow
• Client → Controller (v1/v2) → Converter → Service → Repository → H2 DB
• On responses, flow reverses: Repository → Service → Converter → Controller → Client
• Config classes bootstrap Spring context, Swagger UI, exception advice intercepts errors.
Key architectural patterns & principles
• Layered architecture (Controller → Service → Repository)
• DTO pattern to decouple API contract from persistence model
• API versioning via separate controller packages
• Centralized exception handling
• Dependency Injection via Spring Boot
• Containerization for consistent deployment