Custom Error Messages

Learn how to add customized user-friendly messages on invalid inputs.

Customizing messages

Using the internationalization support we set up earlier, we can change the error messages to something more user-friendly, and have them translated for each language.

We can change the error message for all validation errors of a certain type (e.g., all @NotNull violations) or we can precisely change the message for a single property on a single model attribute.

This is an example of the four options:

Get hands-on with 1200+ tech skills courses.