Bean Validation 2.0 and the reference implementation Hibernate Validator 6.0 were recently released.
I upgraded my application and discovered that fields annotated with @NotEmpty and @NotBlank are not automatically marked as required anymore.
So I started to investigate.
Wicket PropertyValidator marks form components as required if it encounters the @NotNull annotation on a field:
In Bean Validation 1.x, this lookup returns not only properties annotated with
but also properties annotated with
because these annotations are implemented as composed constraints:
Both annotations are now deprecated and replaced with "official" versions:
The new annotations are not implemented as composed constraints, and thus do not contain the @NotNull annotation.
I asked about the rationale and the recommended solution on the HV forum and got the following reply from the Hibernate Team:
When promoting @NotEmpty and @NotBlank from HV to the Bean Validation spec we decided to define them as composed constraints (as their previous counterparts), but instead leave this as an implementation detail to BV providers. The reason being, that the implementation can be more efficient when using a single constraint validator instead of relying on constraint composition.
So you'd indeed have to expand your scan to look for @NotNull, @NotEmpty and @NotBlank.
I suggest that PropertyValidator should scan for these new annotations when Bean Validation 2.0 is on the classpath.