2.17. Bean Validator
Validate the message body using the Java Bean Validation API.
2.17.1. What’s inside リンクのコピーリンクがクリップボードにコピーされました!
-
Bean Validator component, URI syntax:
bean-validator:label
Refer to the above link for usage and configuration details.
2.17.2. Maven coordinates リンクのコピーリンクがクリップボードにコピーされました!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bean-validator</artifactId>
</dependency>
2.17.3. Usage リンクのコピーリンクがクリップボードにコピーされました!
2.17.3.1. 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.
2.17.3.2. 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 {
}
2.17.4. 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).