The Java Validation API allows constraints to be defined with XML and annotations. In a multi-tenant application constraints can vary depending on the tenant. To avoid creating separate deployments for each customer it would be nice to have a way to configure constraints in a more dynamic way. Hibernate Validator provides a programatic API for doing just that; view the documentation.
Using the programatic APIs means that the standard way of creating a ValidatorFactory is not feasible.
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Implementing a ValidationProvider that invokes the programatic APIs allows the Validator to be constructed with the Validation class. This also makes sure that the constraints are always applied to a ValidatorFactory.
ValidatorFactory validatorFactory = Validation.byProvider(RuntimeValidationProvider.class)
A sample implementation can be found in this GitHub repository.