-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spring Integration 6.x to 7.0 Migration Guide
- New
DistributedLock
API - Removal of deprecated classes from
spring-integraiton-hazelcast
- Deprecated Junit 4 Based Components
Spring Integration 7.0 introduces a DistributedLock
abstraction with a Time-To-Live (TTL) API (for now), allowing lock objects in the target persistent store to be marked as expired if the instances holding the lock become unresponsive. This enables other instances to acquire the lock.
With this new abstraction, the LockRegistry
interface—along with its extensions and implementations—now accepts a generic argument to specify the Lock
implementation provided by that particular LockRegistry
.
For example, the DefaultLockRegistry
is now defined as:public final class DefaultLockRegistry implements LockRegistry<Lock>
.
Similarly, ZookeeperLockRegistry
is now:
public class ZookeeperLockRegistry implements ExpirableLockRegistry<Lock>
.
However, JdbcLockRegistry
and RedisLockRegistry
are now defined as:
implements ExpirableLockRegistry<DistributedLock>, RenewableLockRegistry<DistributedLock>
Therefore, the obtain()
method in these registries now returns a DistributedLock
instance, which includes the newly introduced lock(Duration ttl)
and tryLock(Duration waitTime, Duration ttl)
methods.
The RedisLockRegistry
has supported TTL from the beginning via its default expireAfter property. However, with the addition of lock(Duration ttl)
, TTL can now be specified per lock usage.
The JdbcLockRegistry
, being RDBMS-based, required changes to the SQL schema. A new EXPIRED_AFTER
column has been added to the INT_LOCK
table.
As a result, for existing databases, the following DDL statement must be executed to properly migrate to Spring Integration 7.0:
ALTER TABLE INT_LOCK ADD EXPIRED_AFTER TIMESTAMP NOT NULL;
Due to the removal of the CP Subsystem from the open-source edition of Hazelcast, the related Spring Integration classes were deprecated in version 6.5. These classes are now fully removed as outdated APIs. For more information, see the Spring Integration 6.4 to 6.5 Migration Guide.
The classes in spring-integration-test-support
module to support Junit 4 infrastructure, such as Log4j2LevelAdjuster
, AbstractRequestResponseScenarioTests
, LongRunningIntegrationTest
and SingleRequestResponseScenarioTests
, are now deprecated in favor of respective replacements for JUnit Jupiter.
Their JavaDocs have references to replacements.