Class LocalValidatorFactoryBean

java.lang.Object
org.springframework.validation.beanvalidation.SpringValidatorAdapter
org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
All Implemented Interfaces:
Validator, ValidatorFactory, AutoCloseable, Aware, DisposableBean, InitializingBean, ApplicationContextAware, SmartValidator, Validator
Direct Known Subclasses:
OptionalValidatorFactoryBean

public class LocalValidatorFactoryBean extends SpringValidatorAdapter implements ValidatorFactory, ApplicationContextAware, InitializingBean, DisposableBean
This is the central class for jakarta.validation (JSR-303) setup in a Spring application context: It bootstraps a jakarta.validation.ValidationFactory and exposes it through the Spring Validator interface as well as through the JSR-303 Validator interface and the ValidatorFactory interface itself.

When talking to an instance of this bean through the Spring or JSR-303 Validator interfaces, you'll be talking to the default Validator of the underlying ValidatorFactory. This is very convenient in that you don't have to perform yet another call on the factory, assuming that you will almost always use the default Validator anyway. This can also be injected directly into any target dependency of type Validator!

This class is also being used by Spring's MVC configuration namespace, in case of the jakarta.validation API being present but no explicit Validator having been configured.

Since:
3.0
Author:
Juergen Hoeller
See Also: