Skip to content

Commit 454ad96

Browse files
artembilangaryrussell
authored andcommitted
Fix IntNamespaceUtils.injectCtorWithAdapter()
https://build.spring.io/browse/INT-MASTER-1038 When we don't provide an `output-processor` for the `<barrier>` 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
1 parent 97b00a0 commit 454ad96

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,10 @@ public static void injectConstructorWithAdapter(String beanRefAttribute, String
658658

659659
BeanMetadataElement adapter = constructAdapter(beanRefAttribute, methodRefAttribute, expressionAttribute,
660660
adapterClass, element, processor, parserContext);
661-
builder.addConstructorArgValue(adapter);
661+
662+
if (adapter != null) {
663+
builder.addConstructorArgValue(adapter);
664+
}
662665
}
663666

664667
private static BeanMetadataElement constructAdapter(String beanRefAttribute, String methodRefAttribute,

0 commit comments

Comments
 (0)