Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ricpalomino/spring-boot/llms.txt

Use this file to discover all available pages before exploring further.

The Spring Boot Products API is a fully functional REST API for managing a catalog of products. Built on Spring Boot 4.0.6 and Java 17, it exposes a set of HTTP endpoints under /api/v1/products that let you create, read, update, delete, and filter products. Every response is wrapped in a consistent ApiResponse<T> envelope that includes a status code, a human-readable message, and the response payload — making error handling and client integration predictable across all endpoints.

Key features

The API is designed to be a clear reference implementation for production-grade Spring Boot patterns. Here is what it provides out of the box:
  • RESTful CRUD for productsGET, POST, PUT, and DELETE operations on /api/v1/products, plus a /filter endpoint that accepts optional name, minPrice, and maxPrice query parameters.
  • Strategy Pattern service layer — two interchangeable ProductService implementations (ProductServiceBDImpl and ProductServiceApiExternaImpl) that you can swap by changing a single @Primary annotation.
  • In-memory storageProductRepository uses a HashMap with auto-incrementing Long IDs, so the API runs with zero external database dependencies.
  • Request validationProductRequestDTO is annotated with @NotBlank, @Size, and @Min constraints; GlobalExceptionHandler catches MethodArgumentNotValidException and returns structured field-level error details.
  • Global error handling@ControllerAdvice handles ProductNotFoundException, validation errors, and unexpected exceptions uniformly, always returning an ApiResponse envelope.
  • OpenAPI / Swagger UI — powered by springdoc-openapi 2.8.0; the interactive UI is available at http://localhost:8080/swagger-ui.html once the application is running.

Explore the documentation

Quickstart

Clone the repo, build with Maven, and make your first API call in minutes.

Architecture

Understand the layered design, Strategy Pattern, and in-memory repository.

List products

Browse the full interactive API reference for the products endpoints.

Error handling

Learn how GlobalExceptionHandler maps exceptions to consistent API responses.

Tech stack

ComponentDetails
FrameworkSpring Boot 4.0.6 (spring-boot-starter-webmvc)
LanguageJava 17
Build toolMaven (Maven Wrapper included)
Code generationLombok (@Getter, @Setter on entities and DTOs)
Validationspring-boot-starter-validation (Jakarta Bean Validation)
API docsspringdoc-openapi-starter-webmvc-ui 2.8.0
Dev toolingSpring Boot DevTools (live reload on file changes)

Build docs developers (and LLMs) love