public class SpringConstraintValidatorFactory extends Object implements ConstraintValidatorFactory
ConstraintValidatorFactory
implementation that delegates to a
Spring BeanFactory for creating autowired ConstraintValidator
instances.
Note that this class is meant for programmatic use, not for declarative use
in a standard validation.xml
file. Consider
SpringWebConstraintValidatorFactory
for declarative use in a web application, e.g. with JAX-RS or JAX-WS.
AutowireCapableBeanFactory.createBean(Class)
,
ApplicationContext.getAutowireCapableBeanFactory()
Constructor and Description |
---|
SpringConstraintValidatorFactory(AutowireCapableBeanFactory beanFactory)
Create a new SpringConstraintValidatorFactory for the given BeanFactory.
|
Modifier and Type | Method and Description |
---|---|
<T extends ConstraintValidator<?,?>> |
getInstance(Class<T> key) |
void |
releaseInstance(ConstraintValidator<?,?> instance) |
public SpringConstraintValidatorFactory(AutowireCapableBeanFactory beanFactory)
beanFactory
- the target BeanFactorypublic <T extends ConstraintValidator<?,?>> T getInstance(Class<T> key)
getInstance
in interface ConstraintValidatorFactory
public void releaseInstance(ConstraintValidator<?,?> instance)
releaseInstance
in interface ConstraintValidatorFactory