GH-1418 partially cherry-picked from master

This commit is contained in:
Oleg Zhurakousky
2018-07-17 19:00:44 +02:00
parent 53bab2d021
commit 5cc077acda

View File

@@ -16,10 +16,12 @@
package org.springframework.cloud.stream.binding;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import org.springframework.cloud.stream.binder.Binding;
import org.springframework.util.CollectionUtils;
/**
* Coordinates binding/unbinding of input binding targets in accordance to the lifecycle
@@ -32,7 +34,7 @@ public class InputBindingLifecycle extends AbstractBindingLifecycle {
@SuppressWarnings("unused")
//It is actually used reflectively since at the moment we do not want to expose it via public method
private Collection<Binding<Object>> inputBindings;
private Collection<Binding<Object>> inputBindings = new ArrayList<>();
public InputBindingLifecycle(BindingService bindingService, Map<String, Bindable> bindables) {
super(bindingService, bindables);
@@ -49,7 +51,10 @@ public class InputBindingLifecycle extends AbstractBindingLifecycle {
@Override
void doStartWithBindable(Bindable bindable) {
this.inputBindings = bindable.createAndBindInputs(bindingService);
Collection<Binding<Object>> bindableBindings = bindable.createAndBindInputs(bindingService);
if (!CollectionUtils.isEmpty(bindableBindings)) {
this.inputBindings.addAll(bindableBindings);
}
}
@Override