Spring Mvc -- custom validation message for typeMismatch

Viewed 4762

I have a field that requires a double. If you enter a String, the default message is something like:

Failed to convert property value of type java.lang.String to required type java.lang.Double for property price; nested exception is java.lang.NumberFormatException: For input string: "fsd"

A custom message for when the value is not entered. I've set this message doing the following:

@NotNull(message = "price is required")
private Double price;

Is there an equivalent annotation for type mismatch?

2 Answers
Related