當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalValidatorFactoryBean.setProviderClass方法代碼示例

本文整理匯總了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();
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:21,代碼來源:ValidatorFactoryTests.java

示例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);
}
 
開發者ID:OpenHDS,項目名稱:openhds-server,代碼行數:24,代碼來源:HeadOfHouseholdTest.java

示例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;
}
 
開發者ID:numsg,項目名稱:spring-boot-seed,代碼行數:8,代碼來源:WebConfig.java

示例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();
}
 
開發者ID:blacklabelops,項目名稱:crow,代碼行數:8,代碼來源:ValidationTest.java

示例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;
}
 
開發者ID:shilongdai,項目名稱:bookManager,代碼行數:8,代碼來源:RootApplicationContextConfig.java

示例6: setUp

import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    validatorFactoryBean = new LocalValidatorFactoryBean();
    validatorFactoryBean.setProviderClass(HibernateValidator.class);
    validatorFactoryBean.afterPropertiesSet();

}
 
開發者ID:moorkop,項目名稱:mccy-engine,代碼行數:8,代碼來源:MccyAssetSettingsNetworkValidatorTest.java

示例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;
}
 
開發者ID:liuzy163,項目名稱:spring-xml-free-example,代碼行數:8,代碼來源:PuzzleSolvingWebMvcConfig.java

示例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);
}
 
開發者ID:BandwidthOnDemand,項目名稱:bandwidth-on-demand,代碼行數:10,代碼來源:CreatePhysicalPortCommandTest.java

示例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;
}
 
開發者ID:shilongdai,項目名稱:LSChatServer,代碼行數:7,代碼來源:ApplicationRootContext.java

示例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();
}
 
開發者ID:Talend,項目名稱:data-prep,代碼行數:9,代碼來源:AggregationParametersTest.java

示例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();
}
 
開發者ID:Talend,項目名稱:data-prep,代碼行數:9,代碼來源:PreviewAddInputTest.java

示例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();
}
 
開發者ID:Talend,項目名稱:data-prep,代碼行數:9,代碼來源:ExportParametersTest.java

示例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();
}
 
開發者ID:Talend,項目名稱:data-prep,代碼行數:9,代碼來源:DynamicParamsInputTest.java

示例14: validator

import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; //導入方法依賴的package包/類
@Bean
public LocalValidatorFactoryBean validator() {
	final LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
	bean.setProviderClass(HibernateValidator.class);
	return bean;
}
 
開發者ID:liuzy163,項目名稱:spring-xml-free-example,代碼行數:7,代碼來源:TestConfig.java


注:本文中的org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.setProviderClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。