The call to the this.propagateSharedBeans(...) is passing the fromContext and toContext contexts in wrong order. The binderProducingContext should be toContext.
Also calling the binderProducingContext.refresh() before call to this.propagateSharedBeans(..) creates new beans (that depends on shared beans) before shared beans are available for auto-wiring.
Code snippet from org.springframework.cloud.stream.binder.DefaultBinderFactory
if (refresh) {
binderProducingContext.refresh();
if (!useApplicationContextAsParent || "integration".equals(binderType.getDefaultName())) {
this.propagateSharedBeans((GenericApplicationContext) this.context, binderProducingContext);
}
}
should the call be instead....
if (refresh) {
if (!useApplicationContextAsParent || "integration".equals(binderType.getDefaultName())) {
this.propagateSharedBeans(binderProducingContext, (GenericApplicationContext) this.context);
}
binderProducingContext.refresh();
}
is there a tests that covers shared bean propagation ?
|
this.propagateSharedBeans((GenericApplicationContext) this.context, binderProducingContext); |
The call to the this.propagateSharedBeans(...) is passing the fromContext and toContext contexts in wrong order. The binderProducingContext should be toContext.
Also calling the binderProducingContext.refresh() before call to this.propagateSharedBeans(..) creates new beans (that depends on shared beans) before shared beans are available for auto-wiring.
Code snippet from
org.springframework.cloud.stream.binder.DefaultBinderFactoryshould the call be instead....
is there a tests that covers shared bean propagation ?
spring-cloud-stream/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/DefaultBinderFactory.java
Line 484 in 29c3cd7