Bean Validator

JVM since1.0.0 Native since1.0.0

Validate the message body using the Java Bean Validation API.

What’s inside

Please refer to the above link for usage and configuration details.

Maven coordinates

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bean-validator</artifactId>
</dependency>

Check the User guide for more information about writing Camel Quarkus applications.

Usage

Configuring the ValidatorFactory

Implementation of this extension leverages the Quarkus Hibernate Validator extension.

Therefore it is not possible to configure the ValidatorFactory by Camel’s properties (constraintValidatorFactory, messageInterpolator, traversableResolver, validationProviderResolver and validatorFactory).

You can configure the ValidatorFactory by the creation of beans which will be injected into the default ValidatorFactory (created by Quarkus). See the Quarkus CDI documentation for more information.

Custom validation groups in native mode

When using custom validation groups in native mode, all the interfaces need to be registered for reflection (see the documentation).

Example:

@RegisterForReflection
public interface OptionalChecks {
}

Camel Quarkus limitations

It is not possible to describe your constraints as XML (by providing the file META-INF/validation.xml), only Java annotations are supported. This is caused by the limitation of the Quarkus Hibernate Validator extension (see the issue).