ConfigurationPropertiesJsr303Validator Class — spring-boot Architecture
Architecture documentation for the ConfigurationPropertiesJsr303Validator class in ConfigurationPropertiesJsr303Validator.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesJsr303Validator.java lines 33–77
final class ConfigurationPropertiesJsr303Validator implements Validator {
private static final String[] VALIDATOR_CLASSES = { "jakarta.validation.Validator",
"jakarta.validation.ValidatorFactory", "jakarta.validation.bootstrap.GenericBootstrap" };
private final Delegate delegate;
private final Class<?> validatedType;
ConfigurationPropertiesJsr303Validator(ApplicationContext applicationContext, Class<?> validatedType) {
this.delegate = new Delegate(applicationContext);
this.validatedType = validatedType;
}
@Override
public boolean supports(Class<?> type) {
return this.validatedType.equals(type) && this.delegate.supports(type);
}
@Override
public void validate(Object target, Errors errors) {
this.delegate.validate(target, errors);
}
static boolean isJsr303Present(ApplicationContext applicationContext) {
ClassLoader classLoader = applicationContext.getClassLoader();
for (String validatorClass : VALIDATOR_CLASSES) {
if (!ClassUtils.isPresent(validatorClass, classLoader)) {
return false;
}
}
return true;
}
private static class Delegate extends LocalValidatorFactoryBean {
Delegate(ApplicationContext applicationContext) {
setApplicationContext(applicationContext);
setMessageInterpolator(new MessageInterpolatorFactory(applicationContext).getObject());
afterPropertiesSet();
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free