Skip to content

Commit 0cd669f

Browse files
committed
Revert "Fix @InChAdapter for several suppliers"
This reverts commit cd9173c.
1 parent cd9173c commit 0cd669f

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public Object postProcess(Object bean, String beanName, Method method, List<Anno
6464
MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class);
6565
Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty.");
6666

67-
MessageSource<?> messageSource;
67+
MessageSource<?> messageSource = null;
6868
try {
6969
messageSource = createMessageSource(bean, beanName, method);
7070
}
@@ -85,11 +85,10 @@ public Object postProcess(Object bean, String beanName, Method method, List<Anno
8585
return adapter;
8686
}
8787

88-
private MessageSource<?> createMessageSource(Object beanArg, String beanNameArg, Method methodArg) {
88+
private MessageSource<?> createMessageSource(Object beanArg, String beanName, Method methodArg) {
8989
MessageSource<?> messageSource = null;
9090
Object bean = beanArg;
9191
Method method = methodArg;
92-
String beanName = beanNameArg;
9392
if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) {
9493
Object target = resolveTargetBeanFromMethodWithBeanAnnotation(method);
9594
Class<?> targetClass = target.getClass();
@@ -107,12 +106,10 @@ private MessageSource<?> createMessageSource(Object beanArg, String beanNameArg,
107106
else if (target instanceof Supplier<?>) {
108107
method = ClassUtils.SUPPLIER_GET_METHOD;
109108
bean = target;
110-
beanName += '.' + methodArg.getName();
111109
}
112110
else if (ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD != null) {
113111
method = ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD;
114112
bean = target;
115-
beanName += '.' + methodArg.getName();
116113
}
117114
}
118115
if (messageSource == null) {
@@ -133,7 +130,7 @@ else if (ClassUtils.KOTLIN_FUNCTION_0_INVOKE_METHOD != null) {
133130
@Override
134131
protected String generateHandlerBeanName(String originalBeanName, Method method) {
135132
return super.generateHandlerBeanName(originalBeanName, method)
136-
.replaceFirst(IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX + '$', ".source");
133+
.replaceFirst(IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX + "$", ".source");
137134
}
138135

139136
@Override

spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReactiveInboundChannelAdapterTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ public Supplier<Integer> counterMessageSupplier() {
8787
};
8888
}
8989

90-
@Bean
91-
@InboundChannelAdapter(value = "fluxChannel", autoStartup = "false", poller = @Poller(fixedDelay = "100000"))
92-
public Supplier<String> anotherSupplier() {
93-
return () -> "void";
94-
}
95-
9690
@Bean
9791
public MessageChannel fluxChannel() {
9892
return new FluxMessageChannel();

0 commit comments

Comments
 (0)