下面列出了org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler#org.springframework.boot.context.properties.bind.handler.IgnoreTopLevelConverterNotFoundBindHandler 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
static <T> T bindOrCreate(Bindable<T> bindable,
Map<String, Object> properties, String configurationPropertyName,
Validator validator, ConversionService conversionService) {
// see ConfigurationPropertiesBinder from spring boot for this definition.
BindHandler handler = new IgnoreTopLevelConverterNotFoundBindHandler();
if (validator != null) { // TODO: list of validators?
handler = new ValidationBindHandler(handler, validator);
}
List<ConfigurationPropertySource> propertySources = Collections
.singletonList(new MapConfigurationPropertySource(properties));
return new Binder(propertySources, null, conversionService)
.bindOrCreate(configurationPropertyName, bindable, handler);
}
public <T> BindResult<T> bind(String prefix, Bindable<T> target) {
UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter();
NoUnboundElementsBindHandler handler = new NoUnboundElementsBindHandler(new IgnoreTopLevelConverterNotFoundBindHandler(), filter);
return binder.bind(prefix, target, handler);
}
public void bind(String configPrefix, Bindable<?> bean) {
BindHandler handler = new IgnoreTopLevelConverterNotFoundBindHandler();
this.binder.bind(configPrefix, bean, handler);
}