How gustavomiranda-dev/arquitetura-microservices-pedidos works
This Spring Cloud microservices example returns product details with a price that includes a currency-specific tax. The documented request begins at the API Gateway, reaches Product, then calls Price and Tax before the result returns. Product owns product lookup; Price delegates tax calculation; Tax applies the rate. Eureka provides service discovery, and the README also documents load balancing and Swagger/OpenAPI. Source excerpts support the internal calls; gateway routing and service registration are documented in the README, while some configuration and integration details were not sampled.
Main entry points: ProdutoService.java Product workflow · Startup.java Eureka Registry · PrecoService.java Price calculation · ImpostoService.java Tax calculation
Components 22
Access and discovery
- API Gateway
pre-cluster-state/api-gateway/src/main/java/github/io/Gusta_code22/config/ApiGatewayConfiguration.java - Eureka Registry
pre-cluster-state/naming-server/src/main/java/github/io/Gusta_code22/Startup.java
Product service
- Product API
service-produto/src/main/java/github/io/Gusta_code22/controller/ProdutoController.java - Product workflow
service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java - Product repository
service-produto/src/main/java/github/io/Gusta_code22/repository/ProdutoRepository.java - Product records
service-produto/src/main/java/github/io/Gusta_code22/entity/Produto.java - Product response
service-produto/src/main/java/github/io/Gusta_code22/dto/ProdutoDto.java - Price Feign client
service-produto/src/main/java/github/io/Gusta_code22/proxy/PrecoProxy.java - Product errors
service-produto/src/main/java/github/io/Gusta_code22/exception/ProdutoNaoEncontradoException.java - Currency validation
service-produto/src/main/java/github/io/Gusta_code22/exception/MoedaInvalidaException.java
Pricing services
- Price API
service-preco/src/main/java/github/io/Gusta_code22/controller/PrecoController.java - Price calculation
service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java - Tax Feign client
service-preco/src/main/java/github/io/Gusta_code22/proxy/ImpostoProxy.java - Price response
service-preco/src/main/java/github/io/Gusta_code22/dto/PrecoDTO.java - Tax API
service-imposto/src/main/java/github/io/Gusta_code22/controller/ImpostoController.java - Tax calculation
service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java - Tax response
service-imposto/src/main/java/github/io/Gusta_code22/dto/ImpostoDTO.java - Unsupported currency
service-imposto/src/main/java/github/io/Gusta_code22/exception/MoedaNaoSuportadaException.java
API and operations
- Instance metadata
service-preco/src/main/java/github/io/Gusta_code22/enviroment/InstanceInformationService.java - Swagger / OpenAPI
service-produto/src/main
Other components
- Client
- SQL database
Connections 24
- Client → API Gateway: requests
README.md - API Gateway → Product API: routes to
README.md - API Gateway → Eureka Registry: discovers services
README.md - Eureka Registry → Product API: registers instances
README.md - Eureka Registry → Price API: registers instances
README.md - Eureka Registry → Tax API: registers instances
README.md - Product API → Product workflow: calls
service-produto/src/main/java/github/io/Gusta_code22/controller/ProdutoController.java - Product workflow → Product repository: queries
service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java - Product repository → SQL database: persists via JPA
README.md - Product workflow → Price Feign client: requests price
service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java - Product workflow → Product response: builds response
service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java - Product workflow → Product errors: raises when missing
service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java - Product workflow → Currency validation: rejects blank currency
service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java - Price Feign client → Price API: calls price service
README.md - Price API → Price calculation: calls
service-preco/src/main/java/github/io/Gusta_code22/controller/PrecoController.java - Price calculation → Tax Feign client: requests tax
service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java - Tax Feign client → Tax API: calls tax service
README.md - Price calculation → Price response: builds response
service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java - Tax API → Tax calculation: calls
service-imposto/src/main/java/github/io/Gusta_code22/controller/ImpostoController.java - Tax calculation → Tax response: builds response
service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java - Tax calculation → Unsupported currency: rejects unsupported currency
service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java - Price calculation → Instance metadata: reads instance data
service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java - Tax calculation → Instance metadata: reads instance data
service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java - Swagger / OpenAPI → Product API: documents endpoints
README.md