Este README também está disponível em Português.
A Java 21 Spring Boot microservices platform for managing clients, products, and sales. It integrates MongoDB for persistence, Spring Cloud Config Server for centralized configuration, Feign clients for inter-service communication, and OpenAPI/Swagger for API documentation.
- Client, Product, and Sales microservices
- Centralized configuration via Spring Cloud Config Server
- MongoDB persistence with repository pattern
- RESTful APIs documented with OpenAPI/Swagger
- Inter-service communication using Feign clients and RestTemplate
- Structured error handling with custom exceptions and validation errors
- Unit and integration tests across services
- Detailed Javadocs generated for all classes and enums
- Java: 21
- Spring Boot: 3.5.4
- Spring Cloud: 2025.0.0
- Spring Cloud Config Server
- MongoDB
- Feign Clients
- Springdoc OpenAPI (Swagger UI)
- Lombok
- JUnit + Mockito for testing
- The
dockerizedbranch contains full Docker support. - Each service includes a
Dockerfileand.dockerignore. docker-compose.ymlorchestrates all services and MongoDB.wait-for-it.shensures services start only after dependencies are ready.- Centralized configs are fetched from ConfigServer using Docker hostnames.
- ConfigServer: Centralized configuration management for all microservices
- ClientService: Manage clients (CRUD, search by ID/CPF, validations)
- ProductService: Manage products (CRUD, search by code, validations)
- SalesService: Manage sales, sale status lifecycle, and product associations
- Client: Entity with validation, unique indexes, and Swagger annotations
- Product: Entity with validation, status enum (ACTIVE/INACTIVE), and Lombok support
- Sales: Entity with product management, total price calculation, and status lifecycle (STARTED, FINISHED, CANCELED)
- DTOs: Transfer objects for Sales, Product, and Client
- Status Enum: Shared across domains for consistent lifecycle states
Includes full Javadocs for all core classes, including:
- Main classes (SalesServiceApplication, ClientServiceApplication, ProductServiceApplication, ConfigServerApplication).
- Configurations (MongoConfig, OpenAPIConfig, RestTemplateConfig)
- Domain classes (Client, Product, ProductQuantity, Sales)
- DTOs (ClientDTO, ProductDTO, SalesDTO)
- Services and Use Cases (RegisterClient, SearchClient, RegisterProduct, SearchProduct, RegisterSale, SearchSale)
- Controllers (ClientResource, ProductResource, SalesResources)
- Exception handling (ApiError, ApiValidationError, BadRequestException, EntityNotFoundException, RestExceptionHandler)
- Utilities (RestRequest, RestUtils)
- Tests (SalesTest, SalesResourcesTest, ProductResourceTest, ClientResourceTest)
- Unit tests for domains (SalesTest, ProductQuantity logic)
- REST controller tests (SalesResourcesTest, ProductResourceTest, ClientResourceTest)
- Mockito integration for CRUD operations and validations
- Exception handling coverage for BadRequest and EntityNotFound
- Clone the repository:
git clone https://github.com/AsrielDreemurrGM/Microservices_Online_Selling.git - Start the ConfigServer service.
- Start ClientService, ProductService, and SalesService.
- Access API documentation at:
Client Service: http://localhost:8081/swagger-ui.htmlProduct Service: http://localhost:8082/swagger-ui.htmlSales Service: http://localhost:8083/swagger-ui.html - To run with Docker (branch
dockerized):git checkout dockerized docker-compose up --build
- Initial commit with four microservices, config, and build setup
- Client domain, DTO, repository, use cases, resources, and tests
- Product domain, DTO, repository, use cases, resources, configs, and tests
- Sales domain, DTO, services (RegisterSale, SearchSale), resources, and repository
- ConfigServer setup and YML corrections for microservices
- Exception handling standardized across services
- OpenAPI and Mongo configurations added for all services
- Unit tests created and improved for Client, Product, and Sales services
- Detailed Javadocs added across all services, controllers, domains, and configs
- Refactoring of endpoints for clarity
- Configured Docker for microservices (branch
dockerized)