Search in sources :

Example 1 with MessageInterpolatorFactory

use of org.springframework.boot.validation.MessageInterpolatorFactory in project spring-boot by spring-projects.

the class SpringValidator method create.

private static Validator create() {
    OptionalValidatorFactoryBean validator = new OptionalValidatorFactoryBean();
    validator.setMessageInterpolator(new MessageInterpolatorFactory().getObject());
    return wrap(validator, false);
}
Also used : OptionalValidatorFactoryBean(org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean) MessageInterpolatorFactory(org.springframework.boot.validation.MessageInterpolatorFactory)

Example 2 with MessageInterpolatorFactory

use of org.springframework.boot.validation.MessageInterpolatorFactory in project spring-boot by spring-projects.

the class ValidationAutoConfiguration method jsr303Validator.

@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnMissingBean
public static Validator jsr303Validator() {
    LocalValidatorFactoryBean factoryBean = new LocalValidatorFactoryBean();
    MessageInterpolatorFactory interpolatorFactory = new MessageInterpolatorFactory();
    factoryBean.setMessageInterpolator(interpolatorFactory.getObject());
    return factoryBean;
}
Also used : LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean) MessageInterpolatorFactory(org.springframework.boot.validation.MessageInterpolatorFactory) Role(org.springframework.context.annotation.Role) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)

Aggregations

MessageInterpolatorFactory (org.springframework.boot.validation.MessageInterpolatorFactory)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 Role (org.springframework.context.annotation.Role)1 LocalValidatorFactoryBean (org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)1 OptionalValidatorFactoryBean (org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean)1