public class SpringWebConstraintValidatorFactory extends Object implements ConstraintValidatorFactory
ConstraintValidatorFactory
implementation that delegates to
the current Spring WebApplicationContext
for creating autowired
ConstraintValidator
instances.
In contrast to
SpringConstraintValidatorFactory
,
this variant is meant for declarative use in a standard validation.xml
file,
e.g. in combination with JAX-RS or JAX-WS.
ContextLoader.getCurrentWebApplicationContext()
,
SpringConstraintValidatorFactory
Constructor and Description |
---|
SpringWebConstraintValidatorFactory() |
Modifier and Type | Method and Description |
---|---|
<T extends ConstraintValidator<?,?>> |
getInstance(Class<T> key) |
protected WebApplicationContext |
getWebApplicationContext()
Retrieve the Spring
WebApplicationContext to use. |
void |
releaseInstance(ConstraintValidator<?,?> instance) |
public <T extends ConstraintValidator<?,?>> T getInstance(Class<T> key)
getInstance
in interface ConstraintValidatorFactory
public void releaseInstance(ConstraintValidator<?,?> instance)
protected WebApplicationContext getWebApplicationContext()
WebApplicationContext
to use.
The default implementation returns the current WebApplicationContext
as registered for the thread context class loader.null
)ContextLoader.getCurrentWebApplicationContext()