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;
- My need is to validate a Integer field and throw validation error in the request layer itself.
- my db has a field with size 10 which of type int4.
- I don't want user to pass value greater than 10digits.
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.