Package org.springframework.validation.beanvalidation

# Class SpringConstraintValidatorFactory

java.lang.Object
org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory

All Implemented Interfaces:
  `ConstraintValidatorFactory`

public class SpringConstraintValidatorFactory extends Object implements ConstraintValidatorFactory
JSR-303 `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 `org.springframework.web.bind.support.SpringWebConstraintValidatorFactory` for declarative use in a web application, for example, with JAX-RS or JAX-WS.

Since:
  3.0
Author:
  Juergen Hoeller
See Also:
  - `AutowireCapableBeanFactory.createBean(Class)`
  - `ApplicationContext.getAutowireCapableBeanFactory()`

## Constructor Summary

Constructors
Constructor
Description
`SpringConstraintValidatorFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory beanFactory)`
Create a new SpringConstraintValidatorFactory for the given BeanFactory.

## Method Summary

Modifier and Type
Method
Description
`<T extends ConstraintValidator<?, ?>>
T`
`getInstance(Class<T> key)`
`void`
`releaseInstance(ConstraintValidator<?,?> instance)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SpringConstraintValidatorFactory

public SpringConstraintValidatorFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory beanFactory)
Create a new SpringConstraintValidatorFactory for the given BeanFactory.

Parameters:
  `beanFactory` - the target BeanFactory

## Method Details

### getInstance

public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key)

Specified by:
  `getInstance` in interface `ConstraintValidatorFactory`

### releaseInstance

public void releaseInstance(ConstraintValidator<?,?> instance)

Specified by:
  `releaseInstance` in interface `ConstraintValidatorFactory`