[[migration-2.0-2.1]]
= Changes between 2.0 and 2.1

See the https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-2.0-to-2.1-Migration-Guide[Migration Guide] for important changes that might affect your applications.

[[x2.1-new-components]]
== New Components

Version 2.1 added a number of new components.

[[x2.1-new-scripting-support]]
=== JSR-223 Scripting Support

In Spring Integration 2.0, we added support for https://groovy.codehaus.org/[Groovy].
With Spring Integration 2.1, we expanded support for additional languages substantially by implementing support for https://www.jcp.org/en/jsr/detail?id=223[JSR-223] ("`Scripting for the Java™ Platform`").
Now you have the ability to use any scripting language that supports JSR-223 including:

* Javascript
* Ruby and JRuby
* Python and Jython
* Groovy

For further details, see xref:scripting.adoc[Scripting Support].

[[x2.1-new-amqp-support]]
=== AMQP Support

Spring Integration 2.1 added several channel adapters for receiving and sending messages by using the https://www.amqp.org/[Advanced Message Queuing Protocol] (AMQP).
Furthermore, Spring Integration also provides a point-to-point message channel and a publish-subscribe message channel, both of which are backed by AMQP Exchanges and Queues.

For further details, see xref:amqp.adoc[AMQP Support].

[[x2.1-new-mongodb-support]]
=== MongoDB Support

As of version 2.1, Spring Integration provides support for https://www.mongodb.org/[MongoDB] by providing a MongoDB-based `MessageStore`.

For further details, see xref:mongodb.adoc[MongoDb Support].

[[x2.1-new-redis-support]]
=== Redis Support

As of version 2.1, Spring Integration supports https://redis.io/[Redis], an advanced key-value store, by providing a Redis-based `MessageStore` as well as publish-subscribe messaging adapters.

For further details, see xref:redis.adoc[Redis Support].

[[x2.1-new-resource-support]]
=== Support for Spring's Resource abstraction

In version 2.1, we introduced a new resource inbound channel adapter that builds upon Spring's resource abstraction to support greater flexibility across a variety of actual types of underlying resources, such as a file, a URL, or a classpath resource.
Therefore, it is similar to but more generic than the file inbound channel adapter.

For further details, see xref:resource.adoc#resource-inbound-channel-adapter[Resource Inbound Channel Adapter].

[[x2.1-new-stored-proc-support]]
=== Stored Procedure Components

With Spring Integration 2.1, the `JDBC` Module also provides stored procedure support by adding several new components, including inbound and outbound channel adapters and an outbound gateway.
The stored procedure support leverages  Spring's https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/jdbc/core/simple/SimpleJdbcCall.html[`SimpleJdbcCall`] class and consequently supports stored procedures for:

* Apache Derby
* DB2
* MySQL
* Microsoft SQL Server
* Oracle
* PostgreSQL
* Sybase

The stored procedure components also support SQL functions for the following databases:

* MySQL
* Microsoft SQL Server
* Oracle
* PostgreSQL

For further details, see xref:jdbc/stored-procedures.adoc[Stored Procedures].

[[x2.1-new-xpath-filter-support]]
=== XPath and XML Validating Filter

Spring Integration 2.1 provides a new XPath-based message filter.
It is part of the `XML` module.
The XPath filter lets you filter messages by using XPath Expressions.
We also added documentation for the XML validating filter.

For more details, see xref:xml/xpath-filter.adoc[Using the XPath Filter] and xref:xml/validating-filter.adoc[XML Validating Filter].

[[x2.1-new-payload-enricher-support]]
=== Payload Enricher

Since Spring Integration 2.1, we added the payload enricher.
A payload enricher defines an endpoint that typically passes a https://docs.spring.io/spring-integration/api/org/springframework/integration/Message.html[`Message`] to the exposed request channel and then expects a reply message.
The reply message then becomes the root object for evaluation of expressions to enrich the target payload.

For further details, see xref:content-enrichment.adoc#payload-enricher[Payload Enricher].

[[x2.1-new-ftp-outbound-gateway]]
=== FTP and SFTP Outbound Gateways

Spring Integration 2.1 provides two new outbound gateways to interact with remote File Transfer Protocol (FTP) or Secure File Transfer Protocol (SFT) servers.
These two gateways let you directly execute a limited set of remote commands.

For instance, you can use these outbound gateways to list, retrieve, and delete remote files and have the Spring Integration message flow continue with the remote server's response.

For further details, see xref:ftp/outbound-gateway.adoc[FTP Outbound Gateway] and xref:sftp/outbound-gateway.adoc[SFTP Outbound Gateway].

[[x2.1-new-ftp-session-caching]]
=== FTP Session Caching

As of version 2.1, we have exposed more flexibility with regards to session management for remote file adapters (for example, FTP, SFTP, and others).

Specifically, we deprecated the `cache-sessions` attribute (which is available via the XML namespace support).
As an alternative, we added the `sessionCacheSize` and `sessionWaitTimeout` attributes on the `CachingSessionFactory`.

For further details, see xref:ftp/session-caching.adoc[FTP Session Caching] and xref:sftp/session-caching.adoc[SFTP Session Caching].

[[x2.1-framework-refactorings]]
== Framework Refactoring

We refactored the Spring Integration framework in a number of ways, all described in this section.

[[x2.1-router-standardization]]
=== Standardizing Router Configuration

We standardized router parameters across all router implementations with Spring Integration 2.1 to provide a more consistent user experience.

In Spring Integration 2.1, we removed the `ignore-channel-name-resolution-failures` attribute in favor of consolidating its behavior with the `resolution-required` attribute.
Also, the `resolution-required` attribute now defaults to `true`.

Starting with Spring Integration 2.1, routers no longer silently drop any messages if no default output channel was defined.
This means that, by default, routers now require at least one resolved channel (if no `default-output-channel` was set) and, by default, throw a `MessageDeliveryException` if no channel was determined (or an attempt to send was not successful).

If, however, you do want to drop messages silently, you can set `default-output-channel="nullChannel"`.

IMPORTANT: With the standardization of router parameters and the consolidation of the parameters described earlier, older Spring Integration based applications may break.

For further details, see `xref:router.adoc[Routers]`.

[[x2.1-schema-updated]]
=== XML Schemas updated to 2.1

Spring Integration 2.1 ships with an updated XML Schema (version 2.1).
It provides many improvements, such as the Router standardizations xref:changes-2.0-2.1.adoc#x2.1-router-standardization[discussed earlier].

From now on, developers must always declare the latest XML schema (currently version 2.1).
Alternatively, they can use the version-less schema.
Generally, the best option is to use version-less namespaces, as these automatically use the latest available version of Spring Integration.

The following example declares a version-less Spring Integration namespace:

[source,xml]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:int="http://www.springframework.org/schema/integration"
   xsi:schemaLocation="http://www.springframework.org/schema/integration
           https://www.springframework.org/schema/integration/spring-integration.xsd
           http://www.springframework.org/schema/beans
           https://www.springframework.org/schema/beans/spring-beans.xsd">
...
</beans>
----

The following example declares a Spring Integration namespace with an explicit version:

[source,xml]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:int="http://www.springframework.org/schema/integration"
   xsi:schemaLocation="http://www.springframework.org/schema/integration
           https://www.springframework.org/schema/integration/spring-integration-2.2.xsd
           http://www.springframework.org/schema/beans
           https://www.springframework.org/schema/beans/spring-beans.xsd">
...
</beans>
----

The old 1.0 and 2.0 schemas are still there.
However, if an application context still references one of those deprecated schemas, the validator fails on initialization.

[[x2.1-source-control-infrastructure]]
== Source Control Management and Build Infrastructure

Version 2.1 introduced a number of changes to source control management and build infrastructure.
This section covers those changes.

[[x2.1-move-to-github]]
=== Source Code Now Hosted on Github

Since version 2.0, the Spring Integration project uses https://git-scm.com/[Git] for version control.
To increase community visibility even further, the project was moved from SpringSource hosted Git repositories to https://www.github.com/[Github].
The Spring Integration Git repository is located at: https://github.com/spring-projects/spring-integration[spring-integration].

For the project, we also improved the process of providing code contributions.
Further, we ensure that every commit is peer-reviewed.
In fact, core committers now follow the same process as contributors.
For more details, see https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc[Contributing].

[[x2.1-sonar]]
=== Improved Source Code Visibility with Sonar

In an effort to provide better source code visibility and consequently to monitor the quality of Spring Integration's source code, we set up an instance of https://www.sonarqube.org/[Sonar].
We gather metrics nightly and make them available at https://sonar.spring.io/dashboard?id=org.springframework.integration%3Aspring-integration%3Amain[sonar.spring.io].

[[x2.1-new-samples]]
== New Samples

For the 2.1 release of Spring Integration, we also expanded the Spring Integration Samples project and added many new samples, such as samples that cover AMQP support, a sample that showcases the new payload enricher, a sample illustrating techniques for testing Spring Integration flow fragments, and a sample for executing stored procedures against Oracle databases.
For details, visit https://github.com/spring-projects/spring-integration-samples[spring-integration-samples].
