org.springframework.validation.beanvalidation

## Class OptionalValidatorFactoryBean

- java.lang.Object
- - org.springframework.validation.beanvalidation.SpringValidatorAdapter
  - - org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
    - - org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean

- All Implemented Interfaces:
    Validator, ValidatorFactory, Aware, DisposableBean, InitializingBean, ApplicationContextAware, SmartValidator

      public class OptionalValidatorFactoryBean
      extends LocalValidatorFactoryBean

  `LocalValidatorFactoryBean` subclass that simply turns `Validator` calls into no-ops in case of no Bean Validation provider being available.

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

  Since:
    4.0.1
  Author:
    Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OptionalValidatorFactoryBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

    - ### Methods inherited from class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean

      `close, destroy, getConstraintValidatorFactory, getMessageInterpolator, getTraversableResolver, getValidationPropertyMap, getValidator, postProcessConfiguration, setApplicationContext, setConstraintValidatorFactory, setMappingLocations, setMessageInterpolator, setParameterNameDiscoverer, setProviderClass, setTraversableResolver, setValidationMessageSource, setValidationProperties, setValidationPropertyMap, usingContext`

    - ### Methods inherited from class org.springframework.validation.beanvalidation.SpringValidatorAdapter

      `getArgumentsForConstraint, getConstraintsForClass, processConstraintViolations, supports, unwrap, validate, validate, validate, validateProperty, validateValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.validation.ValidatorFactory

      `unwrap`

- - ### Constructor Detail

    - #### OptionalValidatorFactoryBean

          public OptionalValidatorFactoryBean()

  - ### Method Detail

    - #### afterPropertiesSet

          public void afterPropertiesSet()

      Description copied from interface: `InitializingBean`
      Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

      This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`
      Overrides:
        `afterPropertiesSet` in class `LocalValidatorFactoryBean`