Package org.springframework.validation.beanvalidation
@NullMarked
package org.springframework.validation.beanvalidation
support classes for integrating a JsR-303 Bean Validation provider
(such as Hibernate Validator) into a spring ApplicationContext
and in particular with spring's data binding and validation APIs.
The central class is LocalValidatorFactoryBean
which defines a shared ValidatorFactory/Validator setup for availability
to other spring components.
-
ClassDescriptionsimple
BeanPostProcessorthat checks JsR-303 constraint annotations in spring-managed beans, throwing an initialization exception in case of constraint violations right before calling the bean's init method (if any).Configurable bean class that exposes a specific JsR-303 Validator through its original interface as well as through the springValidatorinterface.Delegates to a targetMessageInterpolatorimplementation but enforces spring's managed Locale.This is the central class forjakarta.validation(JsR-303) setup in a spring application context: It bootstraps ajakarta.validation.ValidationFactoryand exposes it through the springValidatorinterface as well as through the JsR-303Validatorinterface and theValidatorFactoryinterface itself.Implementation of Hibernate Validator 4.3/5.x'sResourceBundleLocatorinterface, exposing a springMessagesourceas localizedMessagesourceResourceBundle.MethodValidatorthat uses a Bean ValidationValidatorfor validation, and adaptsConstraintViolations toMethodValidationResult.strategy to resolve the name of an@Validmethod parameter to use for itsBindingResult.An AOP AllianceMethodInterceptorimplementation that delegates to a JsR-303 provider for performing method-level validation on annotated methods.A convenientBeanPostProcessorimplementation that delegates to a JsR-303 provider for performing method-level validation on annotated methods.LocalValidatorFactoryBeansubclass that simply turnsValidatorcalls into no-ops in case of no Bean Validation provider being available.JsR-303ConstraintValidatorFactoryimplementation that delegates to a spring BeanFactory for creating autowiredConstraintValidatorinstances.Adapter that takes a JsR-303javax.validator.Validatorand exposes it as a springValidatorwhile also exposing the original JsR-303 Validator interface itself.