In Spring how do I override default form error massages ?
I'm using a Validator
and a properties file to add my own error messages, but
how do I override messages that get printed on conversion/encoding error for example ?
They seem to be generated automatically and I don't think are helpful for the user:
Failed to convert property value of type java.lang.String to required type java.lang.Double for property minPrice; nested exception is java.lang.NumberFormatException:
You can override the defaults by creating custom messages in your localization bundle with keys following conventions defined by Spring's
DefaultMessageCodeResolver
. For the sake of completeness here is the relevant part of its documentation: