org.springframework.validation.beanvalidation

## 类 BeanValidationPostProcessor

- java.lang.Object
- - org.springframework.validation.beanvalidation.BeanValidationPostProcessor

- 所有已实现的接口:
    org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.InitializingBean

      public class BeanValidationPostProcessor
      extends Object
      implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.InitializingBean

  Simple `BeanPostProcessor` that 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).
  从以下版本开始:
    3.0
  作者:
    Juergen Hoeller

- - ### 构造器概要

    构造器
    构造器和说明
    `BeanValidationPostProcessor()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `afterPropertiesSet()`
    `protected void` | `doValidate(Object bean)` Perform validation of the given bean.
    `Object` | `postProcessAfterInitialization(Object bean, String beanName)`
    `Object` | `postProcessBeforeInitialization(Object bean, String beanName)`
    `void` | `setAfterInitialization(boolean afterInitialization)` Choose whether to perform validation after bean initialization (i.e. after init methods) instead of before (which is the default).
    `void` | `setValidator(Validator validator)` Set the JSR-303 Validator to delegate to for validating beans.
    `void` | `setValidatorFactory(ValidatorFactory validatorFactory)` Set the JSR-303 ValidatorFactory to delegate to for validating beans, using its default Validator.

    - ### 从类继承的方法 java.lang.Object

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

- - ### 构造器详细资料

    - #### BeanValidationPostProcessor

          public BeanValidationPostProcessor()

  - ### 方法详细资料

    - #### setValidator

          public void setValidator(Validator validator)

      Set the JSR-303 Validator to delegate to for validating beans.

      Default is the default ValidatorFactory's default Validator.

    - #### setValidatorFactory

          public void setValidatorFactory(ValidatorFactory validatorFactory)

      Set the JSR-303 ValidatorFactory to delegate to for validating beans, using its default Validator.

      Default is the default ValidatorFactory's default Validator.

      另请参阅:
        `ValidatorFactory.getValidator()`

    - #### setAfterInitialization

          public void setAfterInitialization(boolean afterInitialization)

      Choose whether to perform validation after bean initialization (i.e. after init methods) instead of before (which is the default).

      Default is "false" (before initialization). Switch this to "true" (after initialization) if you would like to give init methods a chance to populate constrained fields before they get validated.

    - #### afterPropertiesSet

          public void afterPropertiesSet()

      指定者:
        `afterPropertiesSet` 在接口中 `org.springframework.beans.factory.InitializingBean`

    - #### postProcessBeforeInitialization

          public Object postProcessBeforeInitialization(Object bean,
                                                        String beanName)
                                                 throws org.springframework.beans.BeansException

      指定者:
        `postProcessBeforeInitialization` 在接口中 `org.springframework.beans.factory.config.BeanPostProcessor`
      抛出:
        `org.springframework.beans.BeansException`

    - #### postProcessAfterInitialization

          public Object postProcessAfterInitialization(Object bean,
                                                       String beanName)
                                                throws org.springframework.beans.BeansException

      指定者:
        `postProcessAfterInitialization` 在接口中 `org.springframework.beans.factory.config.BeanPostProcessor`
      抛出:
        `org.springframework.beans.BeansException`

    - #### doValidate

          protected void doValidate(Object bean)

      Perform validation of the given bean.
      参数:
        `bean` - the bean instance to validate
      另请参阅:
        `Validator.validate(T, java.lang.Class<?>...)`