Using Micronaut's HTTP server APIs
The Micronaut framework offers a non-blocking HTTP server based on Netty. These server APIs can be leveraged to address some useful microservice requirement scenarios. To do any hands-on work, we will continue with the pet-owner
microservice.
At the outset, we must have the following Maven dependency in the project POM:
… <dependency> <groupId>io.micronaut</groupId> <artifactId>micronaut-http-server-netty</artifactId> <scope>compile</scope> </dependency> …
This dependency should already be in the pet-owner
project. In the next sections, we will explore some useful configurations in the HTTP server world.
Binding HTTP requests in the Micronaut framework
There are several ways we can bind arguments to an HTTP request in the Micronaut framework:
@Body
: As discussed before,@Body
binds the argument from the body of the HTTP request.@CookieValue
: This binds...