diff --git a/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoIndexedSessionRepository.java b/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoIndexedSessionRepository.java index 8a7b4ec48..301eacaf2 100644 --- a/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoIndexedSessionRepository.java +++ b/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoIndexedSessionRepository.java @@ -193,6 +193,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) { this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; } + /** + * Set the maximum inactive interval in seconds between requests before newly created + * sessions will be invalidated. A negative time indicates that the session will never + * time out. The default is 1800 (30 minutes). + * @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds + * @deprecated since 3.0.0, in favor of + * {@link #setDefaultMaxInactiveInterval(Duration)} + */ + @Deprecated(since = "3.0.0") + public void setMaxInactiveIntervalInSeconds(Integer defaultMaxInactiveInterval) { + setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval)); + } + public void setCollectionName(final String collectionName) { this.collectionName = collectionName; } diff --git a/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/ReactiveMongoSessionRepository.java b/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/ReactiveMongoSessionRepository.java index fc6bf62fb..71c06c351 100644 --- a/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/ReactiveMongoSessionRepository.java +++ b/spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/ReactiveMongoSessionRepository.java @@ -187,6 +187,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) { this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; } + /** + * Set the maximum inactive interval in seconds between requests before newly created + * sessions will be invalidated. A negative time indicates that the session will never + * time out. The default is 1800 (30 minutes). + * @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds + * @deprecated since 3.0.0, in favor of + * {@link #setDefaultMaxInactiveInterval(Duration)} + */ + @Deprecated(since = "3.0.0") + public void setMaxInactiveIntervalInSeconds(Integer defaultMaxInactiveInterval) { + setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval)); + } + public String getCollectionName() { return this.collectionName; } diff --git a/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/ReactiveRedisSessionRepository.java b/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/ReactiveRedisSessionRepository.java index f91015ca0..0ffb43e38 100644 --- a/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/ReactiveRedisSessionRepository.java +++ b/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/ReactiveRedisSessionRepository.java @@ -85,6 +85,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) { this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; } + /** + * Set the maximum inactive interval in seconds between requests before newly created + * sessions will be invalidated. A negative time indicates that the session will never + * time out. The default is 1800 (30 minutes). + * @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds + * @deprecated since 3.0.0, in favor of + * {@link #setDefaultMaxInactiveInterval(Duration)} + */ + @Deprecated(since = "3.0.0") + public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) { + setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval)); + } + /** * Set the save mode. * @param saveMode the save mode diff --git a/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisIndexedSessionRepository.java b/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisIndexedSessionRepository.java index 3c03beb07..6456811d4 100644 --- a/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisIndexedSessionRepository.java +++ b/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisIndexedSessionRepository.java @@ -379,6 +379,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) { this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; } + /** + * Set the maximum inactive interval in seconds between requests before newly created + * sessions will be invalidated. A negative time indicates that the session will never + * time out. The default is 1800 (30 minutes). + * @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds + * @deprecated since 3.0.0, in favor of + * {@link #setDefaultMaxInactiveInterval(Duration)} + */ + @Deprecated(since = "3.0.0") + public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) { + setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval)); + } + /** * Set the {@link IndexResolver} to use. * @param indexResolver the index resolver diff --git a/spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastIndexedSessionRepository.java b/spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastIndexedSessionRepository.java index 851197d3a..d9be431ba 100644 --- a/spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastIndexedSessionRepository.java +++ b/spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastIndexedSessionRepository.java @@ -194,6 +194,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) { this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; } + /** + * Set the maximum inactive interval in seconds between requests before newly created + * sessions will be invalidated. A negative time indicates that the session will never + * time out. The default is 1800 (30 minutes). + * @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds + * @deprecated since 3.0.0, in favor of + * {@link #setDefaultMaxInactiveInterval(Duration)} + */ + @Deprecated(since = "3.0.0") + public void setDefaultMaxInactiveInterval(Integer defaultMaxInactiveInterval) { + setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval)); + } + /** * Set the {@link IndexResolver} to use. * @param indexResolver the index resolver diff --git a/spring-session-jdbc/src/main/java/org/springframework/session/jdbc/JdbcIndexedSessionRepository.java b/spring-session-jdbc/src/main/java/org/springframework/session/jdbc/JdbcIndexedSessionRepository.java index 3a2e929ea..1d12c1607 100644 --- a/spring-session-jdbc/src/main/java/org/springframework/session/jdbc/JdbcIndexedSessionRepository.java +++ b/spring-session-jdbc/src/main/java/org/springframework/session/jdbc/JdbcIndexedSessionRepository.java @@ -390,6 +390,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) { this.defaultMaxInactiveInterval = defaultMaxInactiveInterval; } + /** + * Set the maximum inactive interval in seconds between requests before newly created + * sessions will be invalidated. A negative time indicates that the session will never + * time out. The default is 1800 (30 minutes). + * @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds + * @deprecated since 3.0.0, in favor of + * {@link #setDefaultMaxInactiveInterval(Duration)} + */ + @Deprecated(since = "3.0.0") + public void setDefaultMaxInactiveInterval(Integer defaultMaxInactiveInterval) { + setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval)); + } + /** * Set the {@link IndexResolver} to use. * @param indexResolver the index resolver