How to create custom validation Annotation | Custom Validation in spring boot

preview_player
Показать описание
How to create custom validation Annotation | Custom Validation in spring boot

The User class represents a user entity with an email field.
We apply the @ValidEmail annotation on the email field to enforce the custom email validation rule defined by the EmailValidator class.

When validating an email address, you might start by using standard validation annotations like @NotNull and @Size.
However, these annotations only check if the email field is not null and if it meets a certain length requirement,
but they do not validate the email format itself.
Рекомендации по теме
Комментарии
Автор

Short simple yet very clear explanation.Thank you.

sreelathavk
Автор

Could you also pls explain three lines of code in ValidEmail interface

sreelathavk
welcome to shbcf.ru