Controller:
@RequestMapping(...)
public void foo(@Valid Parent p){
}
class Parent {
@NotNull // javax.validation.constraints.NotNull
private String name;
List<Child> children;
}
class Child {
@NotNull
private String name;
}
This triggers @NotNull
for Parent.name but doesn't check for Child.name.
How to make it trigger. I tried List<@Valid Child> children;
also annotate Child class with @Valid
annotation, doesn't work. Please help.
parent = { "name": null }
fails. name can't be null.
child = { "name": null }
works.