M
M
Maks Burkov2016-07-15 18:38:35
Java
Maks Burkov, 2016-07-15 18:38:35

Problem with validation, how to view annotation messages in case of bean validation?

Question about the messages that are written in the annotations.
When initializing a variable with an empty string, as in my case, should I get a message output to the console? Where should I see the output of this message? What is missing in this code so that I can get the output of messages during validation?

@NotBlank (message = "First name can't be an empty field")
@NotNull(message = "First name can't be an empty field")
private static String name;

public static void main(String[] args) {

    init("");
}

public static void init(String value){

    name = value;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question