I’m happy to announce the release of the Alpha2 release of the Bean Validation 2 API and specification.
This release contains several improvements and clarifications around the validation of container elements (think
Custom value extractors can now be passed in when bootstrapping a validator factory or validator (via API or XML)
Value extractors are detected via the Java service loader mechanism (e.g. allowing libraries to ship their own extractors for custom collection types)
Property paths for constraint violations on container elements will now contain a node of the new type
Container element constraints can be specified in XML mapping descriptors
There are also some new constraints, as per the community feedback on the survey we did last year:
The first three have been part of the reference implementation for a long time
and have been promoted to the spec due to their frequent usage.
The latter two are new constraints which address the very common use case of
mandating that a numeric value should be positive or negative.
It’s configurable via the
strict() attribute whether 0 should be considered as valid or not.
Together with the spec we also released a new version of the Bean Validation TCK for testing the new features.
Its coordinates are
org.hibernate.beanvalidation.tck:beanvalidation-tck-tests:2.0.0.Alpha3 (it should be synced to Maven Central soon).
If you are wondering why the TCK is at Alpha3 already, that’s because of a glitch with the Alpha2 release which wouldn’t allow to run the TCK in a container. Hence we released the Alpha3 version right after that.
In order to try out the latest Bean Validation features, grab this week’s release of the reference implementation, Hibernate Validator 6 Alpha2.
It supports the Alpha2 version of the spec and some things more. Refer to the announcement post for all the details. Please give it a try and let us know about your thoughts on these changes as well as any other things related to Bean Validation.
We are now working towards the Public Draft of the spec (to be expected in April). The Public Draft will mostly polish the work done so far. Most prominently, the container element validation feature, which currently is an appendix to the spec, will be incorporated in the actual specification sections.