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).
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private Validator |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| protected void | |
| public Object | postProcessAfterInitialization(Object
the new bean instance bean, String the name of the bean beanName)Overrides default org. Apply this |
| public Object | postProcessBeforeInitialization(Object
the new bean instance bean, String the name of the bean beanName)Overrides default org. Apply this |
| 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). |
| public void | |
| public void | setValidatorFactory(ValidatorFactory validatorFactory)
Set the JSR-303 ValidatorFactory to delegate to for validating beans, using its default Validator. |
| afterInitialization | back to summary |
|---|---|
| private boolean afterInitialization | |
| validator | back to summary |
|---|---|
| private Validator validator
| |
| BeanValidationPostProcessor | back to summary |
|---|---|
| public BeanValidationPostProcessor() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| doValidate | back to summary |
|---|---|
| protected void doValidate(Object bean) Perform validation of the given bean.
| |
| postProcessAfterInitialization | back to summary |
|---|---|
| public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException Overrides default org. Doc from org. Apply this In case of a FactoryBean, this callback will be invoked for both the FactoryBean
instance and the objects created by the FactoryBean (as of Spring 2.0). The
post-processor can decide whether to apply to either the FactoryBean or created
objects or both through corresponding This callback will also be invoked after a short-circuiting triggered by a
The default implementation returns the given
| |
| postProcessBeforeInitialization | back to summary |
|---|---|
| public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException Overrides default org. Doc from org. Apply this The default implementation returns the given
| |
| setAfterInitialization | back to summary |
|---|---|
| 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. | |
| setValidator | back to summary |
|---|---|
| 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 | back to summary |
|---|---|
| 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. | |