Mark the annotation of amountthe class field Itemas follows
class Item {
@Digits(integer=6, fraction=2, message="{javax.validation.constraints.Digits.message}")
private BigDecimal amount;
}
In the above class, integerboth are fractionrequired, and the message is an optional parameter for @Digit, and there we can configure our own error message.
ValidationMessages.properties . -..
javax.validation.constraints.Digits.message = "custom error message will be here"