Spring Framework LocalValidatorFactoryBean - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework LocalValidatorFactoryBean class.

This code example shows how to use the following methods:afterPropertiesSet
        assertNotNull(createUserRequest.getAddress().getStreets()); 
        assertTrue(createUserRequest.getAddress().getStreets().size() > 0); 
    } 
 
    private Validator getValidator() { 
        LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean(); 
        localValidatorFactoryBean.afterPropertiesSet(); 
        return localValidatorFactoryBean; 
    } 
} 
 
6
CodeRank
This code example shows how to use the following methods:afterPropertiesSet
		FormattingConversionService cs = fb.getObject(); 
		return cs; 
	} 
 
	private Validator getValidator() { 
		LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); 
		validator.afterPropertiesSet(); 
		return validator; 
	} 
 
	private HttpMessageConverter<?>[] getMessageConverters() { 
		HttpMessageConverter<?>[] converters = new HttpMessageConverter<?>[]{ 
				new ByteArrayHttpMessageConverter(), 
				new StringHttpMessageConverter(), 
				new ResourceHttpMessageConverter(), 
				new SourceHttpMessageConverter(), 
				new XmlAwareFormHttpMessageConverter(), 
 
		}; 
		return converters; 
6
CodeRank
This code example shows how to use the following methods:afterPropertiesSet
	} 
 
	private final class ValidatingBinderFactory implements WebDataBinderFactory { 
		@Override 
		public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception { 
			LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); 
			validator.afterPropertiesSet(); 
			WebDataBinder dataBinder = new WebDataBinder(target, objectName); 
			dataBinder.setValidator(validator); 
			return dataBinder; 
		} 
	} 
 
	@SuppressWarnings("unused") 
	private static class SimpleBean { 
 
		@NotNull 
		private final String name; 
 
		public SimpleBean(String name) { 
6
CodeRank
This code example shows how to use the following methods:afterPropertiesSet
        return dataBinder.getBindingResult(); 
    } 
 
    private Validator getValidator() { 
        if (this.validator == null) { 
            LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean(); 
            localValidatorFactoryBean.afterPropertiesSet(); 
            this.validator = localValidatorFactoryBean; 
        } 
        return this.validator; 
    } 
 
    public FormattingConversionService getFormattingConversionService() { 
        return conversionService; 
    } 
 
    //默认的{@link RopRequest}实现类 
    private class DefaultRopRequest extends AbstractRopRequest { 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
		return initializer; 
	} 
	 
	@Bean 
	Validator mvcValidator() { 
		return new LocalValidatorFactoryBean(); 
	} 
	 
	 
} 
5
CodeRank
This code example shows how to use the following methods:
} 
 
class MyValidatorConfiguration extends MyConfiguration { 
	@Bean 
	public Validator localValidatorFactoryBean() { 
		return new LocalValidatorFactoryBean(); 
	} 
} 
 
@Component 
class MyComponent { 
	@Autowired 
	private Validator validator; 
} 
5
CodeRank
This code example shows how to use the following methods:
@Configuration 
public class UnitTestContext { 
 
    @Bean 
    public LocalValidatorFactoryBean validator() { 
        return new LocalValidatorFactoryBean(); 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:afterPropertiesSet
 * 
 */ 
public class ValidatorTests { 
	 
	private Validator createValidator() {
	      LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
	      localValidatorFactoryBean.afterPropertiesSet();
	      return localValidatorFactoryBean;
	  } 
 
	@Test
    public void emptyFirstName() { 
 
        Person person = new Person();
        person.setFirstName("");
        person.setLastName("smith");
 
        Validator validator = createValidator();
        Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person);
 
5
CodeRank
This code example shows how to use the following methods:afterPropertiesSet
 * 
 */ 
public class ValidatorTests { 
	 
	private Validator createValidator() {
	      LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
	      localValidatorFactoryBean.afterPropertiesSet();
	      return localValidatorFactoryBean;
	  } 
 
	@Test
    public void emptyFirstName() { 
 
	LocaleContextHolder.setLocale(Locale.ENGLISH);
        Person person = new Person();
        person.setFirstName("");
        person.setLastName("smith");
 
        Validator validator = createValidator();
        Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person);
5
CodeRank
This code example shows how to use the following methods:afterPropertiesSet
    /** 
     * Creates and initialises an {@link AssessmentRenderer}, with reasonable default values 
     * for these examples. 
     */ 
    public static AssessmentRenderer createAssessmentRenderer() { 
        final LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
        validator.afterPropertiesSet();
 
        /* (The version number is appended to JS/CSS resource links as query strings to ensure 
         * that new versions get picked when new releases are deployed. This doesn't really 
         * matter here, so we'll use a fake version number) 
         */ 
        final QtiWorksProperties qtiWorksProperties = new QtiWorksProperties();
        qtiWorksProperties.setQtiWorksVersion("VERSION");
 
        final AssessmentRenderer renderer = new AssessmentRenderer();
        renderer.setQtiWorksProperties(qtiWorksProperties);
        renderer.setJsr303Validator(validator);
        renderer.setXsltStylesheetCache(new SimpleXsltStylesheetCache());
        renderer.setWebappContextPath("/qtiworks"); /* (Used for certain links) */

5
CodeRank
See Code Examples for Spring Framework LocalValidatorFactoryBean Methods: