@@ -231,10 +231,9 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
|
||||
private <T> void populateCandidatesForBindableType(Class<? extends T> bindingTargetType, List<String> candidatesForBindableType,
|
||||
String defaultCandidateConfiguration) {
|
||||
// Going by the convention of proper reactor based binders start with the key literal - reactor
|
||||
if (FluxMessageChannel.class.isAssignableFrom(bindingTargetType) && defaultCandidateConfiguration.startsWith("reactor")) {
|
||||
candidatesForBindableType.add(defaultCandidateConfiguration);
|
||||
}
|
||||
else if (!defaultCandidateConfiguration.startsWith("reactor")) {
|
||||
boolean isCandidate = (FluxMessageChannel.class.isAssignableFrom(bindingTargetType) && defaultCandidateConfiguration.startsWith("reactor"))
|
||||
|| !defaultCandidateConfiguration.startsWith("reactor");
|
||||
if (isCandidate) {
|
||||
candidatesForBindableType.add(defaultCandidateConfiguration);
|
||||
}
|
||||
}
|
||||
@@ -276,10 +275,6 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
|
||||
ConfigurableApplicationContext binderProducingContext =
|
||||
this.initializeBinderContextSimple(configurationName, binderProperties, binderType, binderConfiguration);
|
||||
|
||||
// ConfigurableApplicationContext binderProducingContext =
|
||||
// this.initializeBinderContextBoot(configurationName, binderProperties, binderType, binderConfiguration);
|
||||
|
||||
|
||||
Map<String, MessageConverter> messageConverters = binderProducingContext.getBeansOfType(MessageConverter.class);
|
||||
if (!CollectionUtils.isEmpty(messageConverters) && !ObjectUtils.isEmpty(context.getBeansOfType(FunctionCatalog.class))) {
|
||||
FunctionCatalog functionCatalog = this.context.getBean(FunctionCatalog.class);
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.cloud.stream.binding;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.integration.channel.FluxMessageChannel;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author Soby Chacko
|
||||
@@ -33,6 +33,7 @@ public class FluxMessageChannelBindingTargetFactory extends AbstractBindingTarge
|
||||
public FluxMessageChannelBindingTargetFactory(MessageChannelConfigurer messageChannelConfigurer,
|
||||
GenericApplicationContext context) {
|
||||
super(FluxMessageChannel.class);
|
||||
Assert.notNull(context, "'context' must not be null");
|
||||
this.messageChannelConfigurer = messageChannelConfigurer;
|
||||
this.context = context;
|
||||
}
|
||||
@@ -53,20 +54,13 @@ public class FluxMessageChannelBindingTargetFactory extends AbstractBindingTarge
|
||||
|
||||
public FluxMessageChannel fluxMessageChannel(String name) {
|
||||
FluxMessageChannel fluxMessageChannel = null;
|
||||
if (context != null && context.containsBean(name)) {
|
||||
try {
|
||||
fluxMessageChannel = context.getBean(name, FluxMessageChannel.class);
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
// ignore
|
||||
}
|
||||
if (context.containsBean(name)) {
|
||||
fluxMessageChannel = context.getBean(name, FluxMessageChannel.class);
|
||||
}
|
||||
if (fluxMessageChannel == null) {
|
||||
FluxMessageChannel channel = new FluxMessageChannel();
|
||||
channel.setComponentName(name);
|
||||
if (context != null && !context.containsBean(name)) {
|
||||
context.registerBean(name, FluxMessageChannel.class, () -> channel);
|
||||
}
|
||||
context.registerBean(name, FluxMessageChannel.class, () -> channel);
|
||||
fluxMessageChannel = channel;
|
||||
}
|
||||
return fluxMessageChannel;
|
||||
|
||||
Reference in New Issue
Block a user