WildFly, as a compatible Java EE 7 implementation, comes with Bean Validation 1.1 and its reference implementation Hibernate Validator 5 out of the box.
In the following we’ll show you how easy it is to upgrade the server’s modules to the latest Bean Validation release, using a patch file provided by Hibernate Validator.

Getting the patch files

First download the patch file of the Hibernate Validator version you want to upgrade to.
The latest release of Hibernate Validator at this point is 6.0.0.Alpha2
which implements the 2.0.0.Alpha2 release of Bean Validation.
You can simply fetch the patch file for this release from Maven Central.
If you are interested in the latest 5.x release of Hibernate Validator
- which is the current stable implementation of Bean Validation 1.1 -
you’d grab this file instead.

Both patches can be applied to WildFly 10.1 instances.
Generally, we provide patch files for the latest stable version of WildFly at the time of the Hibernate Validator release.

Applying and undoing the patch

Once you’ve downloaded the patch file, change to the installation directory of your WildFly instance and run the following command to apply the patch:

Now (re-)start WildFly and you can begin to experiment with the new features of Hibernate Validator 6 and Bean Validation 2.0,
such as the validation of container elements (think List<@Email String> emails),
support for the Java 8 date/time API or the new built-in constraints such as @NotEmpty or @Email.

The nice thing of the patch mechanism is that patches aren’t actually modifying the patched WildFly instance.
Any modules contained in the patch are just added in a separate "overlays" directory.

So in case you want go back to the version of Hibernate Validator originally coming with the server,
just run this command to undo the patch:

You can learn more about the WildFly patching infrastructure in general here and here.

Bonus: Fully automated update for integration tests

In case you are running integration tests for your applications using the fabulous Arquillian framework,
you can add the following configuration to your pom.xml.
This will first download and extract WildFly, then download the patch file and apply it to the unzipped server:

Applying this configuration will give you a WildFly instance with the latest release of Bean Validation and Hibernate Validator
which you then can use as a deployment target for your integration tests, employing the latest Bean Validation 2.0 features.
You can find a complete Maven project with a simple Arquillian test on GitHub in the hibernate-demos repository.

As you see it’s not difficult to upgrade WildFly 10 to Bean Validation 2.0, so don’t hesitate and give it a try.
Your feedback on the new spec revision is always welcome on the mailing list or in the forum.