I want to MAP my HTTP request parameter value directly to my DTO USING @JsonProperty on the basis of the variable name not by @JsonProperty value. I am not able to map the value to DTO because it's expecting request value according to the JsonProperty name. Is there anyway to disable @JsonProperty value while using the @RequestBody ?
JSON send by frontend:
{
"userId":"1",
"payMethod":"payMethod"
}
MyDto.class public class MyDto{
@JsonProperty(value = user_id, required = true)
private String userId;
@JsonProperty(value = BETAALMETHODE, required = true)
private String payMethod;
//getter setter
}
MyController.class
public class MyController{
@RequestMapping(value = "payment", method = RequestMethod.PUT)
public Integer PaymentUpdate(@RequestBody final MyDto myDto) throws JsonProcessingException {
}
JsonPropertywhy did you define it in the first place?