From 5c525e546cbb76389e48a21e7676054432e858b6 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Mon, 14 Sep 2009 21:59:12 +0000 Subject: [PATCH] polish --- spring-framework-reference/src/validation.xml | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/spring-framework-reference/src/validation.xml b/spring-framework-reference/src/validation.xml index 09ffbee493c..10af3698906 100644 --- a/spring-framework-reference/src/validation.xml +++ b/spring-framework-reference/src/validation.xml @@ -1230,7 +1230,7 @@ public interface FormatterRegistry { @@ -1249,12 +1249,12 @@ public class Person { }]]> - When this object is processed by a JSR-303 Validator, these constraints will be validated. + When an instance of this class is validated by a JSR-303 Validator, these constraints will be enforced. For general information on JSR-303, see the Bean Validation Specification. For information on the specific capabilities of the default reference implementation, see the Hibernate Validator documentation. - For how to setup a JSR-303 implementation as a Spring bean, keep reading. + To learn how to setup a JSR-303 implementation as a Spring bean, keep reading.
@@ -1262,7 +1262,7 @@ public class Person { Spring provides full support for the JSR-303 Bean Validation API. This includes convenient support for bootstrapping a JSR-303 implementation as a Spring bean. - This allows a javax.validation.Validator to be injected wherever validation is needed. + This allows a javax.validation.Validator to be injected wherever validation is needed in your application. Use the LocalValidatorFactoryBean to configure a default JSR-303 Validator as a Spring bean: @@ -1272,13 +1272,13 @@ public class Person { The basic configuration above will trigger JSR-303 to initialize using its default bootstrap mechanism. - The JSR-303 provider, such as Hibernate Validator, will be detected in your classpath automatically. + A JSR-303 provider, such as Hibernate Validator, is expected to be present in the classpath and will be detected automatically.
Injecting a Validator - LocalValidatorFactoryBean implements javax.validation.Validator as well as org.springframework.validation.Validator. - Once created, you may inject a reference to either of these interfaces to other beans that need to invoke JSR-303 validation logic. + LocalValidatorFactoryBean implements both javax.validation.Validator and org.springframework.validation.Validator. + Inject a reference to one of these two interfaces into beans that need to invoke validation logic. Inject a reference to javax.validation.Validator if you prefer to work with the JSR-303 API directly: @@ -1295,7 +1295,7 @@ public class MyService { }]]> - Inject a reference to org.springframework.validation.Validator if you prefer to work with the familiar Spring Validation API: + Inject a reference to org.springframework.validation.Validator if your bean depends on the existing Spring Validation API: - + + + As you can see, the ConstraintValidator implementation above can have its dependencies @Autowired by Spring like any other bean. +
Additional Configuration Options @@ -1447,7 +1451,7 @@ public class MyController { With JSR-303, the default javax.validation.Validator implementation is quite generic. A single instance typically coordinates the validation of all application objects that declare validation constraints. - To configure such a Validator for use by Spring MVC, simply inject a LocalValidatorFactoryBean reference into the WebBindingInitializer as shown in the previous section. + To configure such a Validator for use by Spring MVC, simply inject a LocalValidatorFactoryBean reference into the WebBindingInitializer. LocalValidatorFactoryBean already implements org.springframework.validation.Validation, delegating to the JSR-303 provider underneath. @@ -1468,7 +1472,7 @@ public class MyController { ]]> - With this configuration, anytime a @Valid @Controller method argument is encountered, it will be validated using JSR-303. + With this configuration, anytime a @Valid @Controller method argument is encountered, it will be validated using the JSR-303 provider.