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
This commit is contained in:
Artem Bilan
2018-05-15 16:59:53 -04:00
committed by Gary Russell
parent 97b00a065b
commit 454ad96189

View File

@@ -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,