From 454ad96189eeaf2bdf849ebd805e4a6440fb0477 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 15 May 2018 16:59:53 -0400 Subject: [PATCH] Fix IntNamespaceUtils.injectCtorWithAdapter() https://build.spring.io/browse/INT-MASTER-1038 When we don't provide an `output-processor` for the `` definition, the new logic in the `IntegrationNamespaceUtils.constructAdapter()` ends up with the `null` injection into the `BarrierMessageHandler` ctor. From here there is no guarantee which ctor will be selected: ``` BarrierMessageHandler(long timeout, MessageGroupProcessor outputProcessor) ... BarrierMessageHandler(long timeout, CorrelationStrategy correlationStrategy) ``` From reflection perspective they both are equal and there is no predictable outcome which is is going to be selected. Looks like on Windows and OSX, the second (expected) is selected, but on Linux it is the first one. * Fix `IntegrationNamespaceUtils.injectCtorWithAdapter()` do not inject `adapter` in to the target ctor if it is `null`. This way the `BarrierMessageHandler(long timeout)` ctor is selected without any ambiguity --- .../integration/config/xml/IntegrationNamespaceUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java index e131eb98c5..70448144c7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java @@ -658,7 +658,10 @@ public abstract class IntegrationNamespaceUtils { BeanMetadataElement adapter = constructAdapter(beanRefAttribute, methodRefAttribute, expressionAttribute, adapterClass, element, processor, parserContext); - builder.addConstructorArgValue(adapter); + + if (adapter != null) { + builder.addConstructorArgValue(adapter); + } } private static BeanMetadataElement constructAdapter(String beanRefAttribute, String methodRefAttribute,