Can I use micronaut-serde-jackson + declarative http client + lombok?

531 Views Asked by At

I am attempting to use micronaut-serde-jackson with a declarative HTTP client to make a simple GET request and retrieve a deserialized POJO.

The POJO looks like this (I'm using lombok):

@Data
@Serdeable
public class Thing {
    private String color;
}

The client looks like this:

@Client("http://endpoint/api")
@Header(name = ACCEPT, value = "application/json")
public interface ThingClient {
    @SingleResult
    @Get("/things/{id}")
    Thing resolve(@PathVariable String id);
}

I call the client as follows:

   Thing thing = thingClient.resolve("id123");

The request is successful. Server returns 200 OK, the response json is correct, and a Thing instance is returned, but its color field is null. No errors are logged.

Edit:

It seems that lombok code generation doesn't occur before micronaut's, and serde seems to need getters/setters to exist in order to bind values from the JSON payload, so I end up with no fields being filled.

I'm using Maven and IntelliJ and lombok's annotation processor is defined first in both tools. Not sure why this isn't working; I'll keep poking at it and post back if I find a solution.

0

There are 0 best solutions below