Reputation: 548
To validate a Integer field in Request bean, I used @range (min=0,max=99999999,message="invalid") and @digits().
they are throwing the error
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Numeric value (1111118493411) out of range of int;
How do I handle this in my request layer itself to restrict the user from entering more than 10 digits
@JsonProperty(value = "qty", required = true)
@NotNull
@Range(min=0, max=999999999 , message = "invalid")
private Integer qty;
I wish to throw an error stating invalid if the user enters more than 10 digits.
Upvotes: 2
Views: 1227