org.springframework.validation.beanvalidation

## Class CustomValidatorBean

- java.lang.Object
- - org.springframework.validation.beanvalidation.SpringValidatorAdapter
  - - org.springframework.validation.beanvalidation.CustomValidatorBean

- All Implemented Interfaces:
    Validator, InitializingBean, SmartValidator

      public class CustomValidatorBean
      extends SpringValidatorAdapter
      implements Validator, InitializingBean

  Configurable bean class that exposes a specific JSR-303 Validator through its original interface as well as through the Spring `Validator` interface.
  Since:
    3.0
  Author:
    Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CustomValidatorBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Invoked by the containing `BeanFactory` after it has set all bean properties and satisfied `BeanFactoryAware`, `ApplicationContextAware` etc.
    `void` | `setMessageInterpolator(MessageInterpolator messageInterpolator)` Specify a custom MessageInterpolator to use for this Validator.
    `void` | `setTraversableResolver(TraversableResolver traversableResolver)` Specify a custom TraversableResolver to use for this Validator.
    `void` | `setValidatorFactory(ValidatorFactory validatorFactory)` Set the ValidatorFactory to obtain the target Validator from.

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

      `determineErrorCode, determineField, forExecutables, getArgumentsForConstraint, getConstraintsForClass, getRejectedValue, getResolvableField, processConstraintViolations, requiresMessageFormat, supports, unwrap, validate, validate, validate, validateProperty, validateValue, 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.Validator

      `forExecutables, getConstraintsForClass, unwrap, validate, validateProperty, validateValue`

- - ### Constructor Detail

    - #### CustomValidatorBean

          public CustomValidatorBean()

  - ### Method Detail

    - #### setValidatorFactory

          public void setValidatorFactory(ValidatorFactory validatorFactory)

      Set the ValidatorFactory to obtain the target Validator from.

      Default is `Validation.buildDefaultValidatorFactory()`.

    - #### setMessageInterpolator

          public void setMessageInterpolator(MessageInterpolator messageInterpolator)

      Specify a custom MessageInterpolator to use for this Validator.

    - #### setTraversableResolver

          public void setTraversableResolver(TraversableResolver traversableResolver)

      Specify a custom TraversableResolver to use for this Validator.

    - #### afterPropertiesSet

          public void afterPropertiesSet()

      Description copied from interface: `InitializingBean`
      Invoked by the containing `BeanFactory` after it has set all bean properties and satisfied `BeanFactoryAware`, `ApplicationContextAware` etc.

      This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`