Revert "Fix @InChAdapter for several suppliers"
This reverts commit cd9173cd95.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2020 the original author or authors.
|
* Copyright 2014-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -64,7 +64,7 @@ public class InboundChannelAdapterAnnotationPostProcessor extends
|
|||||||
MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class);
|
MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class);
|
||||||
Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty.");
|
Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty.");
|
||||||
|
|
||||||
MessageSource<?> messageSource;
|
MessageSource<?> messageSource = null;
|
||||||
try {
|
try {
|
||||||
messageSource = createMessageSource(bean, beanName, method);
|
messageSource = createMessageSource(bean, beanName, method);
|
||||||
}
|
}
|
||||||
@@ -85,11 +85,10 @@ public class InboundChannelAdapterAnnotationPostProcessor extends
|
|||||||
return adapter;
|
return adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessageSource<?> createMessageSource(Object beanArg, String beanNameArg, Method methodArg) {
|
private MessageSource<?> createMessageSource(Object beanArg, String beanName, Method methodArg) {
|
||||||
MessageSource<?> messageSource = null;
|
MessageSource<?> messageSource = null;
|
||||||
Object bean = beanArg;
|
Object bean = beanArg;
|
||||||
Method method = methodArg;
|
Method method = methodArg;
|
||||||
String beanName = beanNameArg;
|
|
||||||
if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) {
|
if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) {
|
||||||
Object target = resolveTargetBeanFromMethodWithBeanAnnotation(method);
|
Object target = resolveTargetBeanFromMethodWithBeanAnnotation(method);
|
||||||
Class<?> targetClass = target.getClass();
|
Class<?> targetClass = target.getClass();
|
||||||
@@ -107,12 +106,10 @@ public class InboundChannelAdapterAnnotationPostProcessor extends
|
|||||||
else if (target instanceof Supplier<?>) {
|
else if (target instanceof Supplier<?>) {
|
||||||
method = ClassUtils.SUPPLIER_GET_METHOD;
|
method = ClassUtils.SUPPLIER_GET_METHOD;
|
||||||
bean = target;
|
bean = target;
|
||||||
beanName += '.' + methodArg.getName();
|
|
||||||
}
|
}
|
||||||
else if (ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD != null) {
|
else if (ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD != null) {
|
||||||
method = ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD;
|
method = ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD;
|
||||||
bean = target;
|
bean = target;
|
||||||
beanName += '.' + methodArg.getName();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (messageSource == null) {
|
if (messageSource == null) {
|
||||||
@@ -133,7 +130,7 @@ public class InboundChannelAdapterAnnotationPostProcessor extends
|
|||||||
@Override
|
@Override
|
||||||
protected String generateHandlerBeanName(String originalBeanName, Method method) {
|
protected String generateHandlerBeanName(String originalBeanName, Method method) {
|
||||||
return super.generateHandlerBeanName(originalBeanName, method)
|
return super.generateHandlerBeanName(originalBeanName, method)
|
||||||
.replaceFirst(IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX + '$', ".source");
|
.replaceFirst(IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX + "$", ".source");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -87,12 +87,6 @@ public class ReactiveInboundChannelAdapterTests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
@InboundChannelAdapter(value = "fluxChannel", autoStartup = "false", poller = @Poller(fixedDelay = "100000"))
|
|
||||||
public Supplier<String> anotherSupplier() {
|
|
||||||
return () -> "void";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public MessageChannel fluxChannel() {
|
public MessageChannel fluxChannel() {
|
||||||
return new FluxMessageChannel();
|
return new FluxMessageChannel();
|
||||||
|
|||||||
Reference in New Issue
Block a user