This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Integration 6.4.0!spring-doc.cn

Changes between 4.3 and 5.0

See the Migration Guide for important changes that might affect your applications. You can find migration guides for all versions back to 2.1 on the wiki.spring-doc.cn

New Components

Version 5.0 added a number of new components.spring-doc.cn

Java DSL

The separate Spring Integration Java DSL project has now been merged into the core Spring Integration project. The IntegrationComponentSpec implementations for channel adapters and gateways are distributed to their specific modules. See Java DSL for more information about Java DSL support. See also the 4.3 to 5.0 Migration Guide for the required steps to move to Spring Integration 5.0.spring-doc.cn

Testing Support

We created a new Spring Integration Test Framework to help with testing Spring Integration applications. Now, with the @SpringIntegrationTest annotation on test classes and the MockIntegration factory, you can make your JUnit tests for integration flows somewhat easier.spring-doc.cn

See Testing support for more information.spring-doc.cn

MongoDB Outbound Gateway

The new MongoDbOutboundGateway lets you make queries to the database on demand by sending a message to its request channel.spring-doc.cn

See MongoDB Outbound Gateway for more information.spring-doc.cn

WebFlux Gateways and Channel Adapters

We introduced the new WebFlux support module for Spring WebFlux Framework gateways and channel adapters.spring-doc.cn

See WebFlux Support for more information.spring-doc.cn

Content Type Conversion

Now that we use the new InvocableHandlerMethod-based infrastructure for service method invocations, we can perform contentType conversion from the payload to a target method argument.spring-doc.cn

See Content Type Conversion for more information.spring-doc.cn

ErrorMessagePublisher and ErrorMessageStrategy

We added ErrorMessagePublisher and the ErrorMessageStrategy for creating ErrorMessage instances.spring-doc.cn

See Error Handling for more information.spring-doc.cn

JDBC Metadata Store

We added a JDBC implementation of the MetadataStore implementation. This is useful when you need to ensure transactional boundaries for metadata.spring-doc.cn

See JDBC Metadata Store for more information.spring-doc.cn

General Changes

Spring Integration is now fully based on Spring Framework 5.0 and Project Reactor 3.1. Previous Project Reactor versions are no longer supported.spring-doc.cn

Core Changes

The @Poller annotation now has the errorChannel attribute for easier configuration of the underlying MessagePublishingErrorHandler. See Annotation Support for more information.spring-doc.cn

All the request-reply endpoints (based on AbstractReplyProducingMessageHandler) can now start transactions and, therefore, make the whole downstream flow transactional. See Transaction Support for more information.spring-doc.cn

The SmartLifecycleRoleController now provides methods to obtain status of endpoints in roles. See Endpoint Roles for more information.spring-doc.cn

By default, POJO methods are now invoked by using an InvocableHandlerMethod, but you can configure them to use SpEL, as before. See POJO Method invocation for more information.spring-doc.cn

When targeting POJO methods as message handlers, you can now mark one of the service methods with the @Default annotation to provide a fallback mechanism for non-matched conditions. See Configuring Service Activator for more information.spring-doc.cn

We added a simple PassThroughTransactionSynchronizationFactory to always store a polled message in the current transaction context. That message is used as a failedMessage property of the MessagingException, which wraps any raw exception thrown during transaction completion. See Transaction Synchronization for more information.spring-doc.cn

The aggregator expression-based ReleaseStrategy now evaluates the expression against the MessageGroup instead of just the collection of Message<?>. See Aggregators and Spring Expression Language (SpEL) for more information.spring-doc.cn

You can now supply the ObjectToMapTransformer with a customized JsonObjectMapper.spring-doc.cn

The @GlobalChannelInterceptor annotation and <int:channel-interceptor> now support negative patterns (via ! prepending) for component names matching. See Global Channel Interceptor Configuration for more information.spring-doc.cn

When a candidate failed to acquire the lock, the LockRegistryLeaderInitiator now emits a new OnFailedToAcquireMutexEvent through DefaultLeaderEventPublisher. See Leadership Event Handling for more information.spring-doc.cn

Gateway Changes

When the gateway method has a void return type and an error channel is provided, the gateway now correctly sets the errorChannel header. Previously, the header was not populated. This caused synchronous downstream flows (running on the calling thread) to send the exception to the configured channel, but an exception on an asynchronous downstream flow would be sent to the default errorChannel instead.spring-doc.cn

The RequestReplyExchanger interface now has a throws MessagingException clause to meet the proposed messages exchange contract.spring-doc.cn

You can now specify the request and reply timeouts with SpEL expressions. See Messaging Gateways for more information.spring-doc.cn

Aggregator Performance Changes

By default, aggregators now use a SimpleSequenceSizeReleaseStrategy, which is more efficient, especially with large groups. Empty groups are now scheduled for removal after empty-group-min-timeout. See Aggregator for more information.spring-doc.cn

Splitter Changes

The splitter component can now handle and split Java Stream and Reactive Streams Publisher objects. If the output channel is a ReactiveStreamsSubscribableChannel, the AbstractMessageSplitter builds a Flux for subsequent iteration instead of a regular Iterator, independent of the object being split. In addition, AbstractMessageSplitter provides protected obtainSizeIfPossible() methods to allow determination of the size of the Iterable and Iterator objects, if that is possible. See Splitter for more information.spring-doc.cn

JMS Changes

Previously, Spring Integration JMS XML configuration used a default bean name of connectionFactory for the JMS connection factory, letting the property be omitted from component definitions. We renamed it to jmsConnectionFactory, which is the bean name used by Spring Boot to auto-configure the JMS connection factory bean.spring-doc.cn

If your application relies on the previous behavior, you can rename your connectionFactory bean to jmsConnectionFactory or specifically configure your components to use your bean by using its current name. See JMS Support for more information.spring-doc.cn

Mail Changes

Some inconsistencies with rendering IMAP mail content have been resolved. See the note in the “Mail-receiving Channel Adapter” section for more information.spring-doc.cn

Feed Changes

Instead of the com.rometools.fetcher.FeedFetcher, which is deprecated in ROME, we introduced a new Resource property for the FeedEntryMessageSource. See Feed Adapter for more information.spring-doc.cn

File Changes

We introduced the new FileHeaders.RELATIVE_PATH message header to represent relative path in FileReadingMessageSource.spring-doc.cn

The tail adapter now supports idleEventInterval to emit events when there is no data in the file during that period.spring-doc.cn

The flush predicates for the FileWritingMessageHandler now have an additional parameter.spring-doc.cn

The file outbound channel adapter and gateway (FileWritingMessageHandler) now support the REPLACE_IF_MODIFIED FileExistsMode.spring-doc.cn

They also now support setting file permissions on the newly written file.spring-doc.cn

A new FileSystemMarkerFilePresentFileListFilter is now available. See Dealing With Incomplete Data for more information.spring-doc.cn

The FileSplitter now provides a firstLineAsHeader option to carry the first line of content as a header in the messages emitted for the remaining lines.spring-doc.cn

See File Support for more information.spring-doc.cn

FTP and SFTP Changes

The inbound channel adapters now have a property called max-fetch-size, which is used to limit the number of files fetched during a poll when no files are currently in the local directory. By default, they also are configured with a FileSystemPersistentAcceptOnceFileListFilter in the local-filter.spring-doc.cn

You can also provide a custom DirectoryScanner implementation to inbound channel adapters by setting the newly introduced scanner attribute.spring-doc.cn

You can now configure the regex and pattern filters to always pass directories. This can be useful when you use recursion in the outbound gateways.spring-doc.cn

By default, all the inbound channel adapters (streaming and synchronization-based) now use an appropriate AbstractPersistentAcceptOnceFileListFilter implementation to prevent duplicate downloads of remote files.spring-doc.cn

The FTP and SFTP outbound gateways now support the REPLACE_IF_MODIFIED FileExistsMode when fetching remote files.spring-doc.cn

The FTP and SFTP streaming inbound channel adapters now add remote file information in a message header.spring-doc.cn

The FTP and SFTP outbound channel adapters (as well as the PUT command for outbound gateways) now support InputStream as payload, too.spring-doc.cn

The inbound channel adapters can now build file trees locally by using a newly introduced RecursiveDirectoryScanner. See the scanner option in the FTP Inbound Channel Adapter section for injection. Also, you can now switch these adapters to the WatchService instead.spring-doc.cn

We added The NLST command to the AbstractRemoteFileOutboundGateway to perform the list files names remote command.spring-doc.cn

You can now supply the FtpOutboundGateway with workingDirExpression to change the FTP client working directory for the current request message.spring-doc.cn

The RemoteFileTemplate is supplied now with the invoke(OperationsCallback<F, T> action) to perform several RemoteFileOperations calls in the scope of the same, thread-bounded, Session.spring-doc.cn

We added new filters for detecting incomplete remote files.spring-doc.cn

The FtpOutboundGateway and SftpOutboundGateway now support an option to remove the remote file after a successful transfer by using the GET or MGET commands.spring-doc.cn

See FTP/FTPS Adapters and SFTP Adapters for more information.spring-doc.cn

Integration Properties

Version 4.3.2 added a new spring.integration.readOnly.headers global property to let you customize the list of headers that should not be copied to a newly created Message by the MessageBuilder. See Global Properties for more information.spring-doc.cn

Stream Changes

We added a new option on the CharacterStreamReadingMessageSource to let it be used to “pipe” stdin and publish an application event when the pipe is closed. See Reading from Streams for more information.spring-doc.cn

Barrier Changes

The BarrierMessageHandler now supports a discard channel to which late-arriving trigger messages are sent. See Thread Barrier for more information.spring-doc.cn

AMQP Changes

The AMQP outbound endpoints now support setting a delay expression when you use the RabbitMQ Delayed Message Exchange plugin.spring-doc.cn

The inbound endpoints now support the Spring AMQP DirectMessageListenerContainer.spring-doc.cn

Pollable AMQP-backed channels now block the poller thread for the poller’s configured receiveTimeout (default: one second).spring-doc.cn

Headers, such as contentType, that are added to message properties by the message converter are now used in the final message. Previously, it depended on the converter type as to which headers and message properties appeared in the final message. To override the headers set by the converter, set the headersMappedLast property to true. See AMQP Support for more information.spring-doc.cn

HTTP Changes

By default, the DefaultHttpHeaderMapper.userDefinedHeaderPrefix property is now an empty string instead of X-. See HTTP Header Mappings for more information.spring-doc.cn

By default, uriVariablesExpression now uses a SimpleEvaluationContext (since 5.0.4).spring-doc.cn

See Mapping URI Variables for more information.spring-doc.cn

MQTT Changes

Inbound messages are now mapped with the RECEIVED_TOPIC, RECEIVED_QOS, and RECEIVED_RETAINED headers to avoid inadvertent propagation to outbound messages when an application relays messages.spring-doc.cn

The outbound channel adapter now supports expressions for the topic, qos, and retained properties. The defaults remain the same. See MQTT Support for more information.spring-doc.cn

STOMP Changes

We changed the STOMP module to use ReactorNettyTcpStompClient, based on the Project Reactor 3.1 and reactor-netty extension. We renamed Reactor2TcpStompSessionManager to ReactorNettyTcpStompSessionManager, according to the ReactorNettyTcpStompClient foundation. See STOMP Support for more information.spring-doc.cn

Web Services Changes

You can now supply WebServiceOutboundGateway instances with an externally configured WebServiceTemplate instances.spring-doc.cn

DefaultSoapHeaderMapper can now map a javax.xml.transform.Source user-defined header to a SOAP header element.spring-doc.cn

Simple WebService inbound and outbound gateways can now deal with the complete WebServiceMessage as a payload, allowing the manipulation of MTOM attachments.spring-doc.cn

See Web Services Support for more information.spring-doc.cn

Redis Changes

The RedisStoreWritingMessageHandler is supplied now with additional String-based setters for SpEL expressions (for convenience with Java configuration). You can now configure the zsetIncrementExpression on the RedisStoreWritingMessageHandler as well. In addition, this property has been changed from true to false since the INCR option on ZADD Redis command is optional.spring-doc.cn

You can now supply the RedisInboundChannelAdapter with an Executor for executing Redis listener invokers. In addition, the received messages now contain a RedisHeaders.MESSAGE_SOURCE header to indicate the source of the message (topic or pattern).spring-doc.cn

See Redis Support for more information.spring-doc.cn

TCP Changes

We added a new ThreadAffinityClientConnectionFactory to bind TCP connections to threads.spring-doc.cn

You can now configure the TCP connection factories to support PushbackInputStream instances, letting deserializers “unread” (push back) bytes after “reading ahead”.spring-doc.cn

We added a ByteArrayElasticRawDeserializer without maxMessageSize to control and buffer incoming data as needed.spring-doc.cn

See TCP and UDP Support for more information.spring-doc.cn

JDBC Changes

The JdbcMessageChannelStore now provides a setter for ChannelMessageStorePreparedStatementSetter, letting you customize message insertion in the store.spring-doc.cn

The ExpressionEvaluatingSqlParameterSourceFactory now provides a setter for sqlParameterTypes, letting you customize the SQL types of the parameters.spring-doc.cn

See JDBC Support for more information.spring-doc.cn

Metrics Changes

Micrometer application monitoring is now supported (since version 5.0.2). See Micrometer Integration for more information.spring-doc.cn

Changes were made to the Micrometer Meters in version 5.0.3 to make them more suitable for use in dimensional systems. Further changes were made in 5.0.4. If you use Micrometer, we recommend a minimum of version 5.0.4.

@EndpointId Annotations

Introduced in version 5.0.4, this annotation provides control over bean naming when you use Java configuration. See Endpoint Bean Names for more information.spring-doc.cn