本文整理匯總了Java中org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.setProviderClass方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalValidatorFactoryBean.setProviderClass方法的具體用法?Java LocalValidatorFactoryBean.setProviderClass怎麽用?Java LocalValidatorFactoryBean.setProviderClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
的用法示例。
在下文中一共展示了LocalValidatorFactoryBean.setProviderClass方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSimpleValidationWithCustomProvider
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Test
public void testSimpleValidationWithCustomProvider() throws Exception {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setProviderClass(HibernateValidator.class);
validator.afterPropertiesSet();
ValidPerson person = new ValidPerson();
Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
assertEquals(2, result.size());
for (ConstraintViolation<ValidPerson> cv : result) {
String path = cv.getPropertyPath().toString();
if ("name".equals(path) || "address.street".equals(path)) {
assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NotNull);
}
else {
fail("Invalid constraint violation with path '" + path + "'");
}
}
validator.destroy();
}
示例2: setUp
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Before
public void setUp(){
currentUser.setProxyUser("admin", "test", new String[] {"VIEW_ENTITY", "CREATE_ENTITY"});
assertNotNull(headOfHouseholdService);
localValidatorFactory = new LocalValidatorFactoryBean();
localValidatorFactory.setProviderClass(HibernateValidator.class);
localValidatorFactory.afterPropertiesSet();
oldHoh = genericDao.findByProperty(Individual.class, "extId", "NBAS1I");
newHoh = genericDao.findByProperty(Individual.class, "extId", "BJOH1J");
visit = genericDao.findByProperty(Visit.class, "extId", "VLOCMBI11J");
fieldWorker = genericDao.findByProperty(FieldWorker.class, "extId", "FWEK1D");
socialGroup = genericDao.findByProperty(SocialGroup.class, "extId", "MBI1", false);
assertNotNull(oldHoh);
assertNotNull(newHoh);
assertNotNull(visit);
assertNotNull(fieldWorker);
assertNotNull(socialGroup);
}
示例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: setup
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Before
public void setup() {
job = new Job();
localValidatorFactory = new LocalValidatorFactoryBean();
localValidatorFactory.setProviderClass(HibernateValidator.class);
localValidatorFactory.afterPropertiesSet();
}
示例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: setUp
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
validatorFactoryBean = new LocalValidatorFactoryBean();
validatorFactoryBean.setProviderClass(HibernateValidator.class);
validatorFactoryBean.afterPropertiesSet();
}
示例7: validator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Bean
public LocalValidatorFactoryBean validator() {
final LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
// bean.setValidationMessageSource(messageSource());
bean.setProviderClass(HibernateValidator.class);
return bean;
}
示例8: setUp
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
localValidatorFactory = new LocalValidatorFactoryBean();
localValidatorFactory.setProviderClass(HibernateValidator.class);
localValidatorFactory.afterPropertiesSet();
enniPort = new PhysicalPortFactory().createEnni();
subject = new CreatePhysicalPortCommand(enniPort);
}
示例9: 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"));
return result;
}
示例10: AggregationParametersTest
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Default constructor that initialize the validator factory.
*/
public AggregationParametersTest() {
validator = new LocalValidatorFactoryBean();
validator.setProviderClass(HibernateValidator.class);
validator.afterPropertiesSet();
}
示例11: PreviewAddInputTest
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Default constructor that initialize the validator factory.
*/
public PreviewAddInputTest() {
validator = new LocalValidatorFactoryBean();
validator.setProviderClass(HibernateValidator.class);
validator.afterPropertiesSet();
}
示例12: ExportParametersTest
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Default constructor that initialize the validator factory.
*/
public ExportParametersTest() {
validator = new LocalValidatorFactoryBean();
validator.setProviderClass(HibernateValidator.class);
validator.afterPropertiesSet();
}
示例13: DynamicParamsInputTest
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
/**
* Default constructor that initialize the validator factory.
*/
public DynamicParamsInputTest() {
validator = new LocalValidatorFactoryBean();
validator.setProviderClass(HibernateValidator.class);
validator.afterPropertiesSet();
}
示例14: validator
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Bean
public LocalValidatorFactoryBean validator() {
final LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
bean.setProviderClass(HibernateValidator.class);
return bean;
}