use of jakarta.validation.BootstrapConfiguration in project resteasy by resteasy.
the class AbstractValidatorContextResolver method getContext.
public GeneralValidatorCDI getContext(Class<?> type) {
try {
BootstrapConfiguration bootstrapConfiguration = getConfig();
boolean isExecutableValidationEnabled = bootstrapConfiguration.isExecutableValidationEnabled();
Set<ExecutableType> defaultValidatedExecutableTypes = bootstrapConfiguration.getDefaultValidatedExecutableTypes();
return new GeneralValidatorImpl(getValidatorFactory(), isExecutableValidationEnabled, defaultValidatedExecutableTypes);
} catch (Exception e) {
throw new ValidationException(Messages.MESSAGES.unableToLoadValidationSupport(), e);
}
}
use of jakarta.validation.BootstrapConfiguration in project resteasy by resteasy.
the class AbstractValidatorContextResolver method getConfig.
BootstrapConfiguration getConfig() {
BootstrapConfiguration tmpConfig = bootstrapConfiguration;
if (tmpConfig == null) {
synchronized (RD_LOCK) {
tmpConfig = bootstrapConfiguration;
if (tmpConfig == null) {
config = Validation.byDefaultProvider().configure();
bootstrapConfiguration = tmpConfig = config.getBootstrapConfiguration();
}
}
}
return tmpConfig;
}
use of jakarta.validation.BootstrapConfiguration in project hibernate-validator by hibernate.
the class XmlMappingTest method testScriptEvaluatorFactoryConfiguration.
@Test
@TestForIssue(jiraKey = "HV-1463")
public void testScriptEvaluatorFactoryConfiguration() {
validationXmlTestHelper.runWithCustomValidationXml("script-evaluator-factory-validation.xml", () -> {
// given
BootstrapConfiguration bootstrapConfiguration = ValidatorUtil.getConfiguration().getBootstrapConfiguration();
// then
assertEquals(bootstrapConfiguration.getProperties().get(HibernateValidatorConfiguration.SCRIPT_EVALUATOR_FACTORY_CLASSNAME), CustomScriptEvaluatorFactory.class.getName());
});
}
use of jakarta.validation.BootstrapConfiguration in project hibernate-validator by hibernate.
the class XmlMappingTest method shouldReturnDefaultExecutableTypesIfNoValidationXmlIsGiven.
@Test
@TestForIssue(jiraKey = "HV-707")
public void shouldReturnDefaultExecutableTypesIfNoValidationXmlIsGiven() {
// given
BootstrapConfiguration bootstrapConfiguration = ValidatorUtil.getConfiguration().getBootstrapConfiguration();
// when
// then
assertEquals(bootstrapConfiguration.getDefaultValidatedExecutableTypes(), asSet(ExecutableType.CONSTRUCTORS, ExecutableType.NON_GETTER_METHODS));
}
use of jakarta.validation.BootstrapConfiguration in project hibernate-validator by hibernate.
the class ValidatorFactoryBean method createConstraintValidatorFactory.
private ConstraintValidatorFactory createConstraintValidatorFactory(Configuration<?> config) {
BootstrapConfiguration configSource = config.getBootstrapConfiguration();
String constraintValidatorFactoryFqcn = configSource.getConstraintValidatorFactoryClassName();
if (constraintValidatorFactoryFqcn == null) {
// use default
return createInstance(InjectingConstraintValidatorFactory.class);
}
@SuppressWarnings("unchecked") Class<? extends ConstraintValidatorFactory> constraintValidatorFactoryClass = (Class<? extends ConstraintValidatorFactory>) run(LoadClass.action(constraintValidatorFactoryFqcn, null));
return createInstance(constraintValidatorFactoryClass);
}
Aggregations