下面列出了怎么用org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void preInit(SpringProcessEngineConfiguration springProcessEngineConfiguration) {
GenericProperties genericProperties = camundaBpmProperties.getGenericProperties();
final Map<String, Object> properties = genericProperties.getProperties();
if (!CollectionUtils.isEmpty(properties)) {
ConfigurationPropertySource source = new MapConfigurationPropertySource(properties);
Binder binder = new Binder(source);
try {
if (genericProperties.isIgnoreUnknownFields()) {
binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration));
} else {
binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration), new NoUnboundElementsBindHandler(BindHandler.DEFAULT));
}
} catch (Exception e) {
throw LOG.exceptionDuringBinding(e.getMessage());
}
logger.debug("properties bound to configuration: {}", genericProperties);
}
}
@Override
public void preInit(SpringProcessEngineConfiguration springProcessEngineConfiguration) {
GenericProperties genericProperties = camundaBpmProperties.getGenericProperties();
final Map<String, Object> properties = genericProperties.getProperties();
if (!CollectionUtils.isEmpty(properties)) {
ConfigurationPropertySource source = new MapConfigurationPropertySource(properties);
Binder binder = new Binder(source);
try {
if (genericProperties.isIgnoreUnknownFields()) {
binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration));
} else {
binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration), new NoUnboundElementsBindHandler(BindHandler.DEFAULT));
}
} catch (Exception e) {
throw LOG.exceptionDuringBinding(e.getMessage());
}
logger.debug("properties bound to configuration: {}", genericProperties);
}
}
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);
}