Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ public void processBeanDefinition(String beanName, AnnotatedBeanDefinition beanD

new BeanDefinitionPropertiesMapper(handlerBeanDefinition, annotations)
.setPropertyValue(SEND_TIMEOUT_ATTRIBUTE)
.setPropertyReference("outputChannel")
.setPropertyReference("defaultOutputChannel");
.setPropertyValue("outputChannel", "outputChannelName")
.setPropertyValue("defaultOutputChannel", "defaultOutputChannelName");
}

if (isClassIn(handlerBeanClass, AbstractMessageProducingHandler.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.springframework.integration.aggregator.ExpressionEvaluatingReleaseStrategy;
import org.springframework.integration.annotation.BridgeFrom;
import org.springframework.integration.annotation.BridgeTo;
import org.springframework.integration.annotation.EndpointId;
import org.springframework.integration.annotation.Filter;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
Expand All @@ -63,14 +64,18 @@
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.core.MessageSelector;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.filter.ExpressionEvaluatingSelector;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.splitter.DefaultMessageSplitter;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.transformer.ExpressionEvaluatingTransformer;
import org.springframework.integration.transformer.MessageTransformingHandler;
import org.springframework.integration.transformer.ObjectToMapTransformer;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
Expand Down Expand Up @@ -151,6 +156,10 @@ public class MessagingAnnotationsWithBeanAnnotationTests {
@Autowired
private CountDownLatch reactiveCustomizerLatch;

@Autowired
@Qualifier("objectToMapEndpoint.handler")
private MessageTransformingHandler objectToMapTransformerHandler;

@Test
public void testMessagingAnnotationsFlow() throws InterruptedException {
Stream.of(this.sourcePollingChannelAdapters).forEach(AbstractEndpoint::start);
Expand Down Expand Up @@ -253,6 +262,18 @@ public void testReactiveMessageHandler() {
.verifyComplete();
}

@Test
public void outputChannelIsLazyLoaded() {
assertThat(TestUtils.getPropertyValue(this.objectToMapTransformerHandler, "outputChannelName"))
.isEqualTo("lazilyCreatedChannel");

assertThat(TestUtils.getPropertyValue(this.objectToMapTransformerHandler, "outputChannel")).isNull();

assertThat(this.objectToMapTransformerHandler.getOutputChannel())
.isInstanceOf(DirectChannel.class)
.extracting("beanName")
.isEqualTo("lazilyCreatedChannel");
}

@Configuration
@EnableIntegration
Expand Down Expand Up @@ -460,6 +481,20 @@ public ReactiveMessageHandler reactiveMessageHandlerService() {
};
}

@Bean
@Transformer(inputChannel = "toMapChannel", outputChannel = "lazilyCreatedChannel")
@EndpointId("objectToMapEndpoint")
public ObjectToMapTransformer objectToMapTransformer() {
return new ObjectToMapTransformer();
}

@Bean
public IntegrationFlow lazyChannelFlow() {
return IntegrationFlow.from("lazilyCreatedChannel")
.log()
.nullChannel();
}

}

@Configuration
Expand Down