HTTP Client

Micronaut features an HTTP client that is included by default and automatically instrumented for distributed tracing, service discovery and metrics. The Spring application in the original MuShop features many manually written HTTP calls that amount to another 100 lines of additional code.

This HTTP client logic was completely removed in the Micronaut application as the existing HTTP client was simply injected via service discovery:

public OrdersService(CustomerOrderRepository customerOrderRepository,
                     MeterRegistry meterRegistry,
                     OrdersPublisher ordersPublisher,
                     PaymentClient paymentClient,
                     OrdersConfiguration ordersConfiguration,
                     @Client("users") RxHttpClient userClient,  // HTTP clients injected here
                     @Client("carts") RxHttpClient cartsClient) {