Bean Validation Module


The Bean Validation module provides CDI integration for bean validation. It enables the creation of CDI-aware ConstraintValidator methods that can use business objects (EJBs, ManagedBeans) to support validation needs.

Project Setup

The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in Configure DeltaSpike in Your Projects. For Maven-independent projects, see Configure DeltaSpike in Maven-independent Projects.

Declare Bean Validation Module Dependencies

Add the Bean Validation module to the list of dependencies in the project pom.xml file using this code snippet:


Or if you’re using Gradle, add these dependencies to your build.gradle:

     runtime 'org.apache.deltaspike.modules:deltaspike-bean-validation-module-impl'


A ConstraintValidator inherits the scope defined in the bean class.

A ConstraintValidator may be invoked by multiple threads. For this reason, you should consider using at least RequestScoped validators.

Code Requirements

There are no compile dependencies to use the Bean Validation module. You simply need to override the factory. Then you can build your ConstraintValidator based on CDI programming rules.

Overriding in Java
Validation.byDefaultProvider().configure().constraintValidatorFactory(new CDIAwareConstraintValidatorFactory()).buildValidatorFactory()
Overriding in XML
<validation-config xmlns=""