java.lang.Object | ||
↳ | org.springframework.validation.beanvalidation.SpringValidatorAdapter | |
↳ | org.springframework.validation.beanvalidation.LocalValidatorFactoryBean |
This is the central class for javax.validation
(JSR-303) setup
in a Spring application context: It bootstraps a javax.validation.ValidationFactory
and exposes it through the Spring Validator
interface
as well as through the JSR-303 javax.validation.Validator interface and the
javax.validation.ValidatorFactory interface itself.
When talking to an instance of this bean through the Spring or JSR-303 Validator interfaces,
you'll be talking to the default Validator of the underlying ValidatorFactory. This is very
convenient in that you don't have to perform yet another call on the factory, assuming that
you will almost always use the default Validator anyway. This can also be injected directly
into any target dependency of type Validator
!
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
| |||||||||||
Allow Map access to the bean validation properties to be passed to the validation provider,
with the option to add or override specific entries.
| |||||||||||
Set the ApplicationContext that this object runs in.
| |||||||||||
Specify a custom ConstraintValidatorFactory to use for this ValidatorFactory.
| |||||||||||
Specify resource locations to load XML constraint mapping files from, if any.
| |||||||||||
Specify a custom MessageInterpolator to use for this ValidatorFactory
and its exposed default Validator.
| |||||||||||
Specify the desired provider class, if any.
| |||||||||||
Specify a custom TraversableResolver to use for this ValidatorFactory
and its exposed default Validator.
| |||||||||||
Specify a custom Spring MessageSource for resolving validation messages,
instead of relying on JSR-303's default "ValidationMessages.properties" bundle
in the classpath.
| |||||||||||
Specify bean validation properties to be passed to the validation provider.
| |||||||||||
Specify bean validation properties to be passed to the validation provider as a Map.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.validation.beanvalidation.SpringValidatorAdapter
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
| |||||||||||
From interface
org.springframework.validation.Validator
|
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
Allow Map access to the bean validation properties to be passed to the validation provider, with the option to add or override specific entries.
Useful for specifying entries directly, for example via "validationPropertyMap[myKey]".
Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.
Invoked after population of normal bean properties but before an init callback such
as afterPropertiesSet()
or a custom init-method. Invoked after setResourceLoader(ResourceLoader)
,
setApplicationEventPublisher(ApplicationEventPublisher)
and
MessageSourceAware
, if applicable.
applicationContext | the ApplicationContext object to be used by this object |
---|
Specify a custom ConstraintValidatorFactory to use for this ValidatorFactory.
Default is a SpringConstraintValidatorFactory
, delegating to the
containing ApplicationContext for creating autowired ConstraintValidator instances.
Specify resource locations to load XML constraint mapping files from, if any.
Specify a custom MessageInterpolator to use for this ValidatorFactory and its exposed default Validator.
Specify the desired provider class, if any.
If not specified, JSR-303's default search mechanism will be used.
Specify a custom TraversableResolver to use for this ValidatorFactory and its exposed default Validator.
Specify a custom Spring MessageSource for resolving validation messages, instead of relying on JSR-303's default "ValidationMessages.properties" bundle in the classpath. This may refer to a Spring context's shared "messageSource" bean, or to some special MessageSource setup for validation purposes only.
NOTE: This feature requires Hibernate Validator 4.1 or higher on the classpath. You may nevertheless use a different validation provider but Hibernate Validator's ResourceBundleMessageInterpolator class must be accessible during configuration.
Specify either this property or "messageInterpolator"
,
not both. If you would like to build a custom MessageInterpolator, consider deriving from
Hibernate Validator's ResourceBundleMessageInterpolator and passing in a
Spring MessageSourceResourceBundleLocator
when constructing your interpolator.
MessageSourceResourceBundleLocator
Specify bean validation properties to be passed to the validation provider.
Can be populated with a String "value" (parsed via PropertiesEditor) or a "props" element in XML bean definitions.
Specify bean validation properties to be passed to the validation provider as a Map.
Can be populated with a "map" or "props" element in XML bean definitions.