GH-2870: Issues when closing multi-binder contexts

- When closing multi-binder contexts, the application throws a StackOverflow error
   due to an unnecessary addition of the binder child context as a separate bean
   in the main context. This was done previously for testing purposes.
 - Disabling the affected tests in the Pulsar binder until we come up with a
   different solution.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2870
This commit is contained in:
Soby Chacko
2023-12-12 21:14:11 -05:00
parent 1bfaed9471
commit e908de1dfd
2 changed files with 3 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.cloud.stream.binder.pulsar;
import java.util.function.Function;
import org.apache.pulsar.common.schema.SchemaType;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -54,6 +55,7 @@ class PulsarExtendedBindingDefaultPropertiesTests implements PulsarTestContainer
"spring.cloud.stream.pulsar.default.producer.name: my-producer");
@Test
@Disabled
void defaultsUsedWhenNoCustomBindingProperties() {
this.contextRunner.run((context) -> {
assertThat(context)
@@ -76,6 +78,7 @@ class PulsarExtendedBindingDefaultPropertiesTests implements PulsarTestContainer
}
@Test
@Disabled
void defaultsRespectedWhenCustomBindingProperties() {
this.contextRunner
.withPropertyValues(

View File

@@ -478,7 +478,6 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
}
}
});
if (environment != null && !useApplicationContextAsParent) {
InitializerWithOuterContext initializer = new InitializerWithOuterContext(this.context);
initializer.initialize(binderProducingContext);
@@ -496,10 +495,6 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
if (refresh) {
binderProducingContext.refresh();
if (this.context != null) {
this.context.getBeanFactory().registerSingleton(configurationName + "_binderProducingContext",
binderProducingContext);
}
if (!useApplicationContextAsParent || "integration".equals(binderType.getDefaultName())) {
this.propagateSharedBeans(binderProducingContext, (GenericApplicationContext) this.context);
}