@Valid
. If the parent object is validated, all referenced objects annotated with @Valid
will be validated as well (as will be their children etc.)Groups allow you to restrict the set of constraints applied during validation. This makes for example wizard like validation possible where in each step only a specified subset of constraints get validated. The groups targeted are passed as var-args parameters to validate
, validateProperty
and validateValue
. Let's have a look at an extended Car
with Driver
example. First we have the class Person
(Example 2.12, “Person”) which has a @NotNull
constraint on name. Since no group is specified for this annotation its default group is javax.validation.groups.Default
.
No hay comentarios:
Publicar un comentario