7 The HTTP Client

Using the CLI

If you create your project using the Micronaut CLI, the http-client dependency is included by default.

Client communication between Microservices is a critical component of any Microservice architecture. With that in mind, Micronaut includes an HTTP client that has both a low-level API and a higher-level AOP-driven API.

Regardless whether you choose to use Micronaut’s HTTP server, you may wish to use the Micronaut HTTP client in your application since it is a feature-rich client implementation.

To use the HTTP client, add the http-client dependency to your build:

  1. implementation("io.micronaut:micronaut-http-client")
  1. <dependency>
  2. <groupId>io.micronaut</groupId>
  3. <artifactId>micronaut-http-client</artifactId>
  4. </dependency>

Since the higher level API is built on the low-level HTTP client, we first introduce the low-level client.