For the latest stable version, please use Spring Integration 6.3.4!spring-doc.cn

For the latest stable version, please use Spring Integration 6.3.4!spring-doc.cn

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 4.0 added a number of new components.spring-doc.cn

MQTT Channel Adapters

The MQTT channel adapters (previously available in the Spring Integration Extensions repository) are now available as part of the normal Spring Integration distribution. See MQTT Support.spring-doc.cn

@EnableIntegration

We added the @EnableIntegration annotation to permit declaration of standard Spring Integration beans when using @Configuration classes. See Annotation Support for more information.spring-doc.cn

@IntegrationComponentScan

We added the @IntegrationComponentScan annotation to permit classpath scanning for Spring Integration-specific components. See Annotation Support for more information.spring-doc.cn

“@EnableMessageHistory”

You can now enable message history with the @EnableMessageHistory annotation in a @Configuration class. In addition, a JMX MBean can modify the message history settings. Also, MessageHistory can track auto-created MessageHandler instances for annotated endpoints (such as @ServiceActivator, @Splitter, and others). For more information, see Message History.spring-doc.cn

@MessagingGateway

You can now configure messaging gateway interfaces with the @MessagingGateway annotation. It is an analogue of the <int:gateway/> XML element. For more information, see @MessagingGateway Annotation.spring-doc.cn

Spring Boot @EnableAutoConfiguration

As well as the @EnableIntegration annotation mentioned earlier, we introduced a hook to allow the Spring Integration infrastructure beans to be configured with Spring Boot’s @EnableAutoConfiguration annotation. For more information, see “Auto-configuration” in the Spring Boot Reference Guide.spring-doc.cn

@GlobalChannelInterceptor

As well as the @EnableIntegration annotation mentioned above, we introduced the @GlobalChannelInterceptor annotation. For more information, see Annotation Support.spring-doc.cn

@IntegrationConverter

We introduced the @IntegrationConverter annotation as an analogue of the <int:converter/> component. For more information, see Annotation Support.spring-doc.cn

@EnablePublisher

We added the @EnablePublisher annotation to allow the specification of a default-publisher-channel for @Publisher annotations. See Annotation Support for more information.spring-doc.cn

Redis Channel Message Stores

We added a Redis MessageGroupStore that is optimized for use when backing a QueueChannel for persistence. For more information, see Redis Channel Message Stores.spring-doc.cn

We added a Redis ChannelPriorityMessageStore. You can use it to retrieve messages by priority. For more information, see Redis Channel Message Stores.spring-doc.cn

MongodDB Channel Message Store

The MongoDB support now provides the MongoDbChannelMessageStore, which is a channel-specific MessageStore implementation. With priorityEnabled = true, you can use it in <int:priority-queue> elements to achieve priority order polling of persisted messages. For more information see MongoDB Channel Message Store.spring-doc.cn

@EnableIntegrationMBeanExport

You can now enable the IntegrationMBeanExporter with the @EnableIntegrationMBeanExport annotation in a @Configuration class. For more information, see MBean Exporter.spring-doc.cn

ChannelSecurityInterceptorFactoryBean

ChannelSecurityInterceptorFactoryBean now supports configuration of Spring Security for message channels that use @Configuration classes. For more information, see Security in Spring Integration.spring-doc.cn

Redis Command Gateway

The Redis support now provides the <outbound-gateway> component to perform generic Redis commands by using the RedisConnection#execute method. For more information, see Redis Outbound Command Gateway.spring-doc.cn

RedisLockRegistry

The RedisLockRegistry is now available to support global locks visible to multiple application instances and servers. These can be used with aggregating message handlers across multiple application instances such that group release occurs on only one instance. For more information, see Redis Lock Registry and Aggregator.spring-doc.cn

@Poller

Annotation-based messaging configuration can now have a poller attribute. This means that methods annotated with @ServiceActivator, @Aggregator, and similar annotations can now use an inputChannel that is a reference to a PollableChannel. For more information, see Annotation Support.spring-doc.cn

@InboundChannelAdapter and SmartLifecycle for Annotated Endpoints

We added the @InboundChannelAdapter method annotation. It is an analogue of the <int:inbound-channel-adapter> XML component. In addition, all messaging annotations now provide SmartLifecycle options. For more information, see Annotation Support.spring-doc.cn

Twitter Search Outbound Gateway

We added a new twitter endpoint: <int-twitter-search-outbound-gateway/>. Unlike the search inbound adapter, which polls by using the same search query each time, the outbound gateway allows on-demand customized queries. For more information, see Spring Integration Social Twitter.spring-doc.cn

@BridgeFrom and @BridgeTo Annotations

We introduced @BridgeFrom and @BridgeTo @Bean method annotations to mark MessageChannel beans in @Configuration classes. For more information, see Annotation Support.spring-doc.cn

Meta-messaging Annotations

Messaging annotations (@ServiceActivator, @Router, @MessagingGateway, and others) can now be configured as meta-annotations for user-defined messaging annotations. In addition, the user-defined annotations can have the same attributes (inputChannel, @Poller, autoStartup, and others). For more information, see Annotation Support.spring-doc.cn

General Changes

This section describes general changes from version 3.0 to version 4.0.spring-doc.cn

Requires Spring Framework 4.0

We moved the core messaging abstractions (Message, MessageChannel, and others) to the Spring Framework spring-messaging module. Developers who reference these classes directly in their code need to make changes, as described in the first section of the 3.0 to 4.0 Migration Guide.spring-doc.cn

Header Type for XPath Header Enricher

We introduced the header-type attribute for the header child element of the <int-xml:xpath-header-enricher>. This attribute provides the target type for the header value (to which the result of the XPath expression evaluation is converted). For more information see XPath Header Enricher.spring-doc.cn

Object To JSON Transformer: Node Result

We introduced the result-type attribute for the <int:object-to-json-transformer>. This attribute provides the target type for the result of mapping an object to JSON. It supports STRING (the default) and NODE. For more information see Since version 3.0, Spring Integration also provides a built-in #xpath SpEL function for use in expressions..spring-doc.cn

JMS Header Mapping

The DefaultJmsHeaderMapper now maps an incoming JMSPriority header to the Spring Integration priority header. Previously, priority was only considered for outbound messages. For more information, see Mapping Message Headers to and from JMS Message.spring-doc.cn

JMS Outbound Channel Adapter

The JMS outbound channel adapter now supports the session-transacted attribute (default: false). Previously, you had to inject a customized JmsTemplate to use transactions. See Outbound Channel Adapter.spring-doc.cn

JMS Inbound Channel Adapter

The JMS inbound channel adapter now supports the session-transacted attribute (default: false). Previously, you had to inject a customized JmsTemplate to use transactions. The adapter allowed 'transacted' in the acknowledgeMode, which was incorrect and didn’t work. This value is no longer allowed. See Inbound Channel Adapter.spring-doc.cn

Datatype Channels

You can now specify a MessageConverter to be used when converting (if necessary) payloads to one of the accepted datatype instances in a Datatype channel. For more information, see Datatype Channel Configuration.spring-doc.cn

Simpler Retry Advice Configuration

We added simplified namespace support to configure a RequestHandlerRetryAdvice. For more information, see Configuring the Retry Advice.spring-doc.cn

Correlation Endpoint: Time-based Release Strategy

We added the mutually exclusive group-timeout and group-timeout-expression attributes to <int:aggregator> and <int:resequencer>. These attributes allow forced completion of a partial MessageGroup, provided the ReleaseStrategy does not release a group and no further messages arrive within the time specified. For more information, see Configuring an Aggregator with XML.spring-doc.cn

Redis Metadata Store

The RedisMetadataStore now implements ConcurrentMetadataStore, letting it be used, for example, in an AbstractPersistentAcceptOnceFileListFilter implementation in a multiple application instance or server environment. For more information, see Redis Metadata Store, Reading Files, FTP Inbound Channel Adapter, and SFTP Inbound Channel Adapter.spring-doc.cn

JdbcChannelMessageStore and PriorityChannel

T`JdbcChannelMessageStore` now implements PriorityCapableChannelMessageStore, letting it be used as a message-store reference for priority-queue instances. For more information, see Backing Message Channels.spring-doc.cn

AMQP Endpoints Delivery Mode

Spring AMQP, by default, creates persistent messages on the broker. You can override this behavior by setting the amqp_deliveryMode header or customizing the mappers. We added a convenient default-delivery-mode attribute to the adapters to provide easier configuration of this important setting. For more information, see Outbound Channel Adapter and Outbound Gateway.spring-doc.cn

FTP Timeouts

The DefaultFtpSessionFactory now exposes the connectTimeout, defaultTimeout, and dataTimeout properties, avoiding the need to subclass the factory to set these common properties. The postProcess* methods are still available for more advanced configuration. See FTP Session Factory for more information.spring-doc.cn

Twitter: StatusUpdatingMessageHandler

The StatusUpdatingMessageHandler (<int-twitter:outbound-channel-adapter>) now supports the tweet-data-expression attribute to build a org.springframework.social.twitter.api.TweetData object for updating the timeline status. This feature allows, for example, attaching an image. See Spring Integration Social Twitter for more information.spring-doc.cn

JPA Retrieving Gateway: id-expression

We introduced the id-expression attribute for <int-jpa:retrieving-outbound-gateway> to perform EntityManager.find(Class entityClass, Object primaryKey). See Retrieving Outbound Gateway for more information.spring-doc.cn

TCP Deserialization Events

When one of the standard deserializers encounters a problem decoding the input stream to a message, it now emits a TcpDeserializationExceptionEvent, letting applications examine the data at the point at which the exception occurred. See TCP Connection Events for more information.spring-doc.cn

Messaging Annotations on @Bean Definitions

You can now configure messaging annotations (@ServiceActivator, @Router, @InboundChannelAdapter, and others) on @Bean definitions in @Configuration classes. For more information, see Annotation Support.spring-doc.cn