DefaultMessageCodesResolver()
Default implementation of the MessageCodesResolver interface.
Will create two message codes for an object error, in the following order (when using the prefixed formatter):
Will create four message codes for a field specification, in the following order:
For example, in case of code "typeMismatch", object name "user", field "age":
This resolution algorithm thus can be leveraged for example to show specific messages for binding errors like "required" and "typeMismatch":
In case of array, List or java.util.Map properties, both codes for specific elements and for the whole collection are generated. Assuming a field "name" of an array "groups" in object "user":
By default the errorCodes will be placed at the beginning of constructed message strings. The messageCodeFormatter property can be used to specify an alternative concatenation MessageCodeFormatter.
In order to group all codes into a specific category within your resource bundles, e.g. "validation.typeMismatch.name" instead of the default "typeMismatch.name", consider specifying a prefix to be applied.
Author
Juergen Hoeller
Author
Phillip Webb
Author
Chris Beams
Since
1.0.1