Search in sources :

Example 1 with ValidatorContext

use of javax.validation.ValidatorContext in project spring-framework by spring-projects.

the class CustomValidatorBean method afterPropertiesSet.

@Override
public void afterPropertiesSet() {
    if (this.validatorFactory == null) {
        this.validatorFactory = Validation.buildDefaultValidatorFactory();
    }
    ValidatorContext validatorContext = this.validatorFactory.usingContext();
    MessageInterpolator targetInterpolator = this.messageInterpolator;
    if (targetInterpolator == null) {
        targetInterpolator = this.validatorFactory.getMessageInterpolator();
    }
    validatorContext.messageInterpolator(new LocaleContextMessageInterpolator(targetInterpolator));
    if (this.traversableResolver != null) {
        validatorContext.traversableResolver(this.traversableResolver);
    }
    setTargetValidator(validatorContext.getValidator());
}
Also used : ValidatorContext(javax.validation.ValidatorContext) MessageInterpolator(javax.validation.MessageInterpolator)

Aggregations

MessageInterpolator (javax.validation.MessageInterpolator)1 ValidatorContext (javax.validation.ValidatorContext)1