Skip to content

Commit 009cb5b

Browse files
vpavicrwinch
authored andcommitted
Fix max inactive interval setters backwards compatibility
This commit restores integer based max inactive interval setters across all session repositories, that were migrated to java.time in 6d74cf5. This change caused problems building our Spring Boot based samples, as Spring Boot auto-configuration has move to session repository customizer based approach and is therefore using max inactive interval setters directly on session repository implementations.
1 parent 525b841 commit 009cb5b

File tree

6 files changed

+78
-0
lines changed

6 files changed

+78
-0
lines changed

spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoIndexedSessionRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) {
193193
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
194194
}
195195

196+
/**
197+
* Set the maximum inactive interval in seconds between requests before newly created
198+
* sessions will be invalidated. A negative time indicates that the session will never
199+
* time out. The default is 1800 (30 minutes).
200+
* @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds
201+
* @deprecated since 3.0.0, in favor of
202+
* {@link #setDefaultMaxInactiveInterval(Duration)}
203+
*/
204+
@Deprecated(since = "3.0.0")
205+
public void setMaxInactiveIntervalInSeconds(Integer defaultMaxInactiveInterval) {
206+
setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval));
207+
}
208+
196209
public void setCollectionName(final String collectionName) {
197210
this.collectionName = collectionName;
198211
}

spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/ReactiveMongoSessionRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) {
187187
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
188188
}
189189

190+
/**
191+
* Set the maximum inactive interval in seconds between requests before newly created
192+
* sessions will be invalidated. A negative time indicates that the session will never
193+
* time out. The default is 1800 (30 minutes).
194+
* @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds
195+
* @deprecated since 3.0.0, in favor of
196+
* {@link #setDefaultMaxInactiveInterval(Duration)}
197+
*/
198+
@Deprecated(since = "3.0.0")
199+
public void setMaxInactiveIntervalInSeconds(Integer defaultMaxInactiveInterval) {
200+
setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval));
201+
}
202+
190203
public String getCollectionName() {
191204
return this.collectionName;
192205
}

spring-session-data-redis/src/main/java/org/springframework/session/data/redis/ReactiveRedisSessionRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) {
8585
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
8686
}
8787

88+
/**
89+
* Set the maximum inactive interval in seconds between requests before newly created
90+
* sessions will be invalidated. A negative time indicates that the session will never
91+
* time out. The default is 1800 (30 minutes).
92+
* @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds
93+
* @deprecated since 3.0.0, in favor of
94+
* {@link #setDefaultMaxInactiveInterval(Duration)}
95+
*/
96+
@Deprecated(since = "3.0.0")
97+
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
98+
setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval));
99+
}
100+
88101
/**
89102
* Set the save mode.
90103
* @param saveMode the save mode

spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisIndexedSessionRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) {
379379
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
380380
}
381381

382+
/**
383+
* Set the maximum inactive interval in seconds between requests before newly created
384+
* sessions will be invalidated. A negative time indicates that the session will never
385+
* time out. The default is 1800 (30 minutes).
386+
* @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds
387+
* @deprecated since 3.0.0, in favor of
388+
* {@link #setDefaultMaxInactiveInterval(Duration)}
389+
*/
390+
@Deprecated(since = "3.0.0")
391+
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
392+
setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval));
393+
}
394+
382395
/**
383396
* Set the {@link IndexResolver} to use.
384397
* @param indexResolver the index resolver

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastIndexedSessionRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) {
194194
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
195195
}
196196

197+
/**
198+
* Set the maximum inactive interval in seconds between requests before newly created
199+
* sessions will be invalidated. A negative time indicates that the session will never
200+
* time out. The default is 1800 (30 minutes).
201+
* @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds
202+
* @deprecated since 3.0.0, in favor of
203+
* {@link #setDefaultMaxInactiveInterval(Duration)}
204+
*/
205+
@Deprecated(since = "3.0.0")
206+
public void setDefaultMaxInactiveInterval(Integer defaultMaxInactiveInterval) {
207+
setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval));
208+
}
209+
197210
/**
198211
* Set the {@link IndexResolver} to use.
199212
* @param indexResolver the index resolver

spring-session-jdbc/src/main/java/org/springframework/session/jdbc/JdbcIndexedSessionRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,19 @@ public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval) {
390390
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
391391
}
392392

393+
/**
394+
* Set the maximum inactive interval in seconds between requests before newly created
395+
* sessions will be invalidated. A negative time indicates that the session will never
396+
* time out. The default is 1800 (30 minutes).
397+
* @param defaultMaxInactiveInterval the default maxInactiveInterval in seconds
398+
* @deprecated since 3.0.0, in favor of
399+
* {@link #setDefaultMaxInactiveInterval(Duration)}
400+
*/
401+
@Deprecated(since = "3.0.0")
402+
public void setDefaultMaxInactiveInterval(Integer defaultMaxInactiveInterval) {
403+
setDefaultMaxInactiveInterval(Duration.ofSeconds(defaultMaxInactiveInterval));
404+
}
405+
393406
/**
394407
* Set the {@link IndexResolver} to use.
395408
* @param indexResolver the index resolver

0 commit comments

Comments
 (0)