use of cn.taketoday.validation.beanvalidation.ValidatorAdapter in project today-infrastructure by TAKETODAY.
the class BinderTests method bindToValidatedBeanWithResourceAndNonEnumerablePropertySource.
@Test
void bindToValidatedBeanWithResourceAndNonEnumerablePropertySource() {
ConfigurationPropertySources.from(new PropertySource<String>("test") {
@Override
public Object getProperty(String name) {
return null;
}
}).forEach(this.sources::add);
Validator validator = new ValidatorAdapter(Validation.byDefaultProvider().configure().buildValidatorFactory().getValidator());
this.binder.bind("foo", Bindable.of(ResourceBean.class), new ValidationBindHandler(validator));
}
use of cn.taketoday.validation.beanvalidation.ValidatorAdapter in project today-framework by TAKETODAY.
the class BinderTests method bindToValidatedBeanWithResourceAndNonEnumerablePropertySource.
@Test
void bindToValidatedBeanWithResourceAndNonEnumerablePropertySource() {
ConfigurationPropertySources.from(new PropertySource<String>("test") {
@Override
public Object getProperty(String name) {
return null;
}
}).forEach(this.sources::add);
Validator validator = new ValidatorAdapter(Validation.byDefaultProvider().configure().buildValidatorFactory().getValidator());
this.binder.bind("foo", Bindable.of(ResourceBean.class), new ValidationBindHandler(validator));
}
Aggregations