diff --git a/spring-framework-reference/src/validation.xml b/spring-framework-reference/src/validation.xml index 9ffceec8894..701d96794c9 100644 --- a/spring-framework-reference/src/validation.xml +++ b/spring-framework-reference/src/validation.xml @@ -1278,7 +1278,7 @@ public class Person {
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.
+ You may inject a reference to one of these two interfaces into beans that need to invoke validation logic.
javax.validation.Validator if you prefer to work with the JSR-303 API directly:
@@ -1295,7 +1295,7 @@ public class MyService {
}]]>
org.springframework.validation.Validator if your bean depends on the existing Spring Validation API:
+ Inject a reference to org.springframework.validation.Validator if your bean requires the Spring Validation API:
ConstraintValidatorFactory then creates instances of this class when the constraint annotation is encountered in your domain model.
+ To associate a declaration with an implementation, each @Constraint annotation references a corresponding ValidationConstraint implementation class.
+ At runtime, a ConstraintValidatorFactory instantiates the referenced implementation when the constraint annotation is encountered in your domain model.
LocalValidatorFactoryBean automatically configures a SpringConstraintValidatorFactory that uses Spring to create ConstraintValidator instances.
+ By default, the LocalValidatorFactoryBean configures a SpringConstraintValidatorFactory that uses Spring to create ConstraintValidator instances.
This allows your custom ConstraintValidators to benefit from dependency injection like any other Spring bean.
ConstraintValidator implementation that uses Spring for dependency injection:
LocalValidatorFactoryBean configuration should prove sufficient for most cases.
- There are a number of other explicit configuration options for various JSR-303 constructs, from message interpolation to traversal resolution.
+ There are a number of other configuration options for various JSR-303 constructs, from message interpolation to traversal resolution.
See the JavaDocs of LocalValidatorFactoryBean more information on these options.
binder.validate().
+ Once configured, the Validator may be invoked by calling binder.validate().
Any validation Errors are automatically added to the binder's BindingResults.
javax.validation.Validator implementation is quite generic.
+ With JSR-303, the default javax.validation.Validator implementation is generic.
A single instance typically coordinates the validation of LocalValidatorFactoryBean reference into the WebBindingInitializer.
- LocalValidatorFactoryBean already implements org.springframework.validation.Validation, delegating to the JSR-303 provider underneath.
+ To configure such a general purpose Validator for use by Spring MVC, simply inject a LocalValidatorFactoryBean reference into the WebBindingInitializer.
+ LocalValidatorFactoryBean already implements org.springframework.validation.Validator, and delegates to the JSR-303 provider underneath.