本文整理匯總了Java中org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.setValidationMessageSource方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalValidatorFactoryBean.setValidationMessageSource方法的具體用法?Java LocalValidatorFactoryBean.setValidationMessageSource怎麽用?Java LocalValidatorFactoryBean.setValidationMessageSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
的用法示例。
在下文中一共展示了LocalValidatorFactoryBean.setValidationMessageSource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Custom validator.
* @param messageSource {@link MessageSource}
* @return de {@link Validator}
*/
@Bean
public Validator validator(MessageSource messageSource) {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
示例2: getValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Override
public Validator getValidator() {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setValidationMessageSource(messageSource);
return validator;
}
示例3: getValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Override
public Validator getValidator() {
LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
localValidatorFactoryBean.setProviderClass(org.hibernate.validator.HibernateValidator.class);
localValidatorFactoryBean.setValidationMessageSource(messageSource());
return localValidatorFactoryBean;
}
示例4: defaultValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/** BeanValidationメッセージのUTF-8に対応したValidator。 */
@Bean
LocalValidatorFactoryBean defaultValidator(MessageSource message) {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(message);
return factory;
}
示例5: localValidatorFactoryBean
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Bean
public LocalValidatorFactoryBean localValidatorFactoryBean() throws ClassNotFoundException {
LocalValidatorFactoryBean result = new LocalValidatorFactoryBean();
result.setProviderClass(Class.forName("org.hibernate.validator.HibernateValidator"));
result.setValidationMessageSource(this.messageSource());
return result;
}
示例6: getValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Override
public Validator getValidator() {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setValidationMessageSource(messageSource());
return validator;
}
示例7: createValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
public static Validator createValidator() {
LocaleContextHolder.setLocale(Locale.ENGLISH);
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setFallbackToSystemLocale(false);
messageSource.setBasenames("validation");
messageSource.setDefaultEncoding("utf8");
LocalValidatorFactoryBean localValidator = new LocalValidatorFactoryBean();
localValidator.setValidationMessageSource(messageSource);
localValidator.afterPropertiesSet();
return localValidator;
}
示例8: validator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Validator bean that is used during Hibernate annotation validation.
* This validator bean makes it possible to resolve the error messages defined within the message source files.
*
* @return the local validator factory bean
*/
@Bean
public LocalValidatorFactoryBean validator() {
LocalValidatorFactoryBean validatorFactoryBean = new LocalValidatorFactoryBean();
validatorFactoryBean.setValidationMessageSource(messageSource());
return validatorFactoryBean;
}
示例9: defaultValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/** BeanValidationメッセージのUTF-8に対応したValidator。 */
@Bean
public LocalValidatorFactoryBean defaultValidator(MessageSource message) {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(message);
return factory;
}
示例10: localValidatorFactoryBean
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Override
protected LocalValidatorFactoryBean localValidatorFactoryBean() {
LocalValidatorFactoryBean validatorFactoryBean = new LocalValidatorFactoryBean();
validatorFactoryBean.setValidationMessageSource(messageKeyResolver);
return validatorFactoryBean;
}
示例11: getValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Override
public Validator getValidator()
{
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
示例12: validator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Bean
public LocalValidatorFactoryBean validator() {
LocalValidatorFactoryBean validatorFactoryBean = new LocalValidatorFactoryBean();
if (Boolean.parseBoolean(env.getProperty("validation.resolveErrorCodes"))) {
validatorFactoryBean.setValidationMessageSource(messageSource);
}
return validatorFactoryBean;
}
示例13: getValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Get Validator .
*
* @return validator
*/
@Override
public Validator getValidator() {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setValidationMessageSource(messageSource);
return validator;
}
示例14: getValidator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
public Validator getValidator() {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("/WEB-INF/messages/validation");
if (environment.acceptsProfiles("embedded")) {
messageSource.setCacheSeconds(0);
}
factory.setValidationMessageSource(messageSource);
return factory;
}
示例15: validator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Bean
public Validator validator() {
final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
localValidatorFactoryBean.setValidationMessageSource(messageSource());
return localValidatorFactoryBean;
}