Skip to content

Spring Integration 4.1 to 4.2 Migration Guide

Artem Bilan edited this page Aug 7, 2018 · 12 revisions

Class Package Change

  • The ScatterGatherHandler class has been moved from org.springframework.integration.handler to org.springframework.integration.scattergather.

TCP Serializers

The TCP Serializers no longer flush() the OutputStream; this is now done by the TcpNxxConnection classes. If you are using the serializers directly within user code, you may have to flush() the OutputStream after serialization.

Reactor dependency changes

The Project Reactor has been upgraded to version 2.0 and its dependency has been marked as optional, to avoid extra transitive dependencies for those applications, which aren't interested in the Reactive Streams features, like Promise Gateway.

Those application which already uses Reactor with Spring Integration since version 4.1 must include its dependency explicitly now:

compile "io.projectreactor:reactor-core:2.0.0.RELEASE"

In addition the FunctionIterator has been changed to use org.springframework.integration.util.Function instead of similar class from the Reactor before.

Important. Since version 2.0 the Reactor is based on the Reactive Streams and there were done a lot of great changes, including package location. So, be sure that you have updated your code which is based on the previous Reactor version.

HTTP

Before Spring Integration 4.0 the MessageHeaders.CONTENT_TYPE constant had had a value content-type. It was appropriate header name to be mapped to the HTTP header Content-Type. But since migration to Spring Messaging MessageHeaders.CONTENT_TYPE constant has a value contentType. It prevented to map Message header to the HTTP request properly. Now DefaultHttpHeaderMapper has been changed to map MessageHeaders.CONTENT_TYPE to HTTP response Content-Type header, if the default configuration is used. It allows to propagate Message state to the HTTP response automatically:

<int-http:inbound-gateway path="/foo" request-channel="httpRequest"/>

<int:object-to-json-transformer input-channel="httpRequest"/>

SFTP

To enhance secururity, the DefaultSftpSessionFactory no longer allows unknown host keys by default. You can provide a pre-populated known_hosts file via the knownHosts property or, to revert to the previous behavior, set the allowUnknownKeys property to false.

If you provide a known hosts file and you set allowUnknownKeys to true, the new key(s) will be added to the file.

File

When injecting a custom directory scanner into a file inbound channel adapter; it is now necessary to set the locker and filters on the scanner and not on the adapter itself.

Previously, settings on the adapter unconditionally overwrote any user settings on the scanner which was clearly incorrect.

Since the framework has no knowledge as to how an external scanner is configured it errs on the side of caution and you need to configure the scanner completely yourself.

This includes filter-related settings such as prevent-duplicates (which internally configures an AcceptOnceFileListFilter when true).

xPath Splitter

The XPathMessageSplitter is now based on the iterator algorithm for more optimized records processing. Returning internal NodeListIterator, this functionality eliminates the possibility to determine the amount of the splitted items. The sequenceSize header is 0 in this case.

JMS

The JmsMessageDrivenEndpoint now configures a default acknowledge mode to the transacted, unless an external container is provided, in which case the container should be configured as needed. It is recommended to use transacted with the DefaultMessageListenerContainer to avoid message loss.