I have a REST payload which has a boolean
property. And am using Lombok @Data since it is handy. However this is resulting in unexpected behaviour while working with JAX-RS. Below is the POJO used as REST payload:
@Data
public class Foo implements Serializable {
private long id;
private String bar;
private boolean isDefault;
}
Lombok adds below getter and setter:
isDefault() // getter
setDefault() // setter
And I was using below paylod to make POST call:
{
"id": 1,
"bar": "Something interesting",
"isDefault": true
}
Now is the real problem, while making a REST call JAX-RS is looking for setIsDefault() and would never set the value for isDefault.