I'm using a very convenient set of lombok annotations for my DTOs:
@Value
@Builder
@Jacksonized
public class Stuff {
String a;
String b;
...
}
Jackson is able to deserialize my objects from request body:
@PostMapping("/stuff")
public void postStuff(
@RequestBody Stuff stuff
) {
...
}
However if I use such object in a GET request (GET /stuff?a=xxx&b=yyy) spring is unable to assemble it from request parameters and I get the "No primary or default constructor found for class" Exception.
@Value
@Builder
@Jacksonized
public class GetStuffParameters {
String a;
String b;
...
}
@GetMapping("/stuff")
public List<Stuff> getStuff(
GetStuffParameters parameters
) {
...
}
How do I force Spring Boot to use lombok builders while assembling DTO from request parameters?