Check that you have included this dependency in pom.xml



You are using the annotations in the wrong way and your controller is also missing an annotation.

You should annotate your controller with @Validated:

public class MyController { ... }

And in your model class you need to place the annotations like this:

private List<@Valid Foo> foo;

The @Valid annotation will check if the items inside the list are also valid.

Related Query

More Query from same tag