I have an email field in a Person
class:
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
public class Person {
@NotBlank(message = "error.message.email.invalid")
@Email(message = "error.message.email.invalid")
private String email;
//Getter & Setter...
}
As we know @javax.validation.constraints.Email
accept empty sting but I wont accept it, so for that I use @NotBlank to avoid this specific case.
Is there any way to to use one annotation to avoid the same error message in @NotBlank
and @Email
?