Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native compilation section to Hibernate Validator guide #30335

Merged
merged 2 commits into from
Jan 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/src/main/asciidoc/validation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,25 @@ To configure the `ValidatorFactory`, use the exposed configuration properties an

Consequently, the only way to define constraints in Quarkus is by annotating your classes.

=== ValidatorFactory and native executables

Quarkus provides a default `ValidatorFactory` that you can customize using configuration properties.
This `ValidatorFactory` is carefully initialized to support native executables
using a bootstrap that is Quarkus-specific.

Creating a `ValidatorFactory` by yourself it not supported in native executables
and if you try to do so,
you will get an error similar to `javax.validation.NoProviderFoundException: Unable to create a Configuration, because no
Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your
classpath.` when running your native executable.

Thus why you should always use the Quarkus-managed `ValidatorFactory` by injecting an instance of
`ValidatorFactory` or directly an instance of `Validator` using CDI injection.

To support some external libraries that are creating a `ValidatorFactory` using the default bootstrap,
Quarkus returns the `ValidatorFactory` managed by Quarkus when `Validation.buildDefaultValidatorFactory()`
is called.

[[configuration-reference]]
== Hibernate Validator Configuration Reference

Expand Down