I know you have been waiting in anticipation, but now it is available - Hibernate Validator 5.2.1.Final :-). Given that it is a drop-in replacement for all 5.x releases, there is no reason to delay an upgrade. Just go and get it.
For the more cautious, here again the highlights of the 5.2 release with pointers to more information.
Java 8 Support, most notably the ability to validate
Optionaland the new date/time types. Types, which do not represent an instant on the time-line, however, are not supported out of the box. This includes, for example,
LocalDateand its sub-types. Semantically it does not make sense to talk about future and past, if your data type cannot be unambiguously tied to an instant in time. This is still a bit of a open discussion (see HV-981) though. Contact us if you have an opinion.
Support for Java 8 also includes the use of type annotation constraints like:
private List<@AcmeEmail String> emails;
In this case each element of the
emailslist (or more generally of any
Iterable) will be validated using the
@AcmeEmail. Note the use of a custom constraint and not the Hibernate Validator provided
java.lang.annotation.ElementType.TYPE_USEin their definition for now. Adding it would break backwards compatibility to Java 6.
Java 8 is not a requirement for Hibernate Validator 5.2. It is still backward compatible with Java 6. Java 8 specific features are only enabled in case a Java 8 runtime is detected.
Ability to provide custom constraints discoverable via the Java ServiceLoader mechanism. Under the hood this uses the new
ConstraintMappingContributorSPI. read more…
Ability to use Hibernate Validator without dependency to the Expression Language libraries by using the new
ParameterMessageInterpolator. read more…
Ability to provide an external
ClassLoader. Potentially handy for modularized environments. read more…
Apache Karaf feature file. read more…
Extension of the Path API for nodes of type
ElementKind.PROPERTY, which allows to obtain the value of the represented property. read more…
TimeProvider contract. read more…
Tons of bug fixes
Where to get it
Maven artifacts can be found in the JBoss Maven repository, as well as in Maven Central. The GAV is org.hibernate:hibernate-validator:5.2.1.Final. Distribution bundles will be uploaded to SourceForge once it has recovered from its storage fault.
Further development will be driven by the upcoming Bean Validation update -
Bean Validation 1.2. Most likely this will align with a Hibernate Validator 6
requiring Java 8. This will be necessary to make use of all the new features
Java 8 offers, amongst others the use of
This is in alignment with other technologies which are part of the Java EE 8
Watch for changes to the Hibernate Validator roadmap, as well as announcements on this and the Bean Validation blog.
Let us know what you think
Last but not least, a big thank you to all of you who were lending a helping hand along the way, be it via a bug report or more hands on via a pull request. Special thanks to Khalid who kicked of the work on the 5.2 release series with his Google Summer of Code work. Thank you also for the smaller contributions provided by Denis Tiago, Nicolas Francois, Xavier Sosnovsky, dernasherbrezon, stawny and tonnyyi. Finally a thank you to all other Hibernate team members who were involved.
* In case you are wondering what happened with 5.2.0.Final, it became obsolete while waiting for SourceForge to recover. In the meantime an IBM JVM specific issue (HV-1007) was reported and fixed.