diff --git a/src/reference/docbook/validation.xml b/src/reference/docbook/validation.xml index 5ad3faeee8..2eb98a76b0 100644 --- a/src/reference/docbook/validation.xml +++ b/src/reference/docbook/validation.xml @@ -12,6 +12,24 @@
Introduction + + JSR-303 Bean Validation + + The Spring Framework supports JSR-303 Bean Validation adapting + it to Spring's Validator interface. + + An application can choose to enable JSR-303 Bean Validation once globally, + as described in , and use it + exclusively for all validation needs. + + An application can also register + additional Spring Validator instances + per DataBinder instance, as described in + . This may be useful for + plugging in validation logic without the use of annotations. + + + There are pros and cons for considering validation as business logic, and Spring offers a design for validation (and data binding) that does not exclude either one of them. Specifically validation should not be tied to @@ -1778,6 +1796,16 @@ binder.validate(); // get BindingResult that includes any validation errors BindingResult results = binder.getBindingResult(); + + A DataBinder can also be configured with multiple + Validator instances + via dataBinder.addValidators + and dataBinder.replaceValidators. + This is useful when combining globally configured JSR-303 Bean Validation + with a Spring Validator configured + locally on a DataBinder instance. + See . +
@@ -1847,6 +1875,20 @@ public class MyController { ]]> + + To combine a global and a local validator, configure the + global validator as shown above and then add a local validator: + + +