Validation
By default, if Bean Validation is present
on the classpath (for example, Hibernate Validator), the LocalValidatorFactoryBean
is
registered as a global Validator for use with @Valid
and
@Validated
on controller method arguments.
You can customize the global Validator
instance, as the
following example shows:
Note that you can also register Validator
implementations locally, as the following
example shows:
If you need to have a LocalValidatorFactoryBean injected somewhere, create a bean and
mark it with @Primary in order to avoid conflict with the one declared in the MVC configuration.
|