coherence-spring
coherence-spring copied to clipboard
Spring Session: Document different way to specify the session timeouts
We should document the various ways to specify session timeouts (expiration of HTTP session entries in the respective Coherence cache). This should also include an explanation of the overriding behavior in case session expiration timeouts are specified in multiple locations:
-
Setting the expiry via coherence-cache-config.xml
-
In Spring boot using
spring.session.timeout = 10m
-
Via annotation
@EnableCoherenceHttpSession(sessionTimeoutInSeconds = 5)
-
By extending
CoherenceSpringSessionConfiguration
-
By declaring a
SessionRepositoryCustomizer<CoherenceIndexedSessionRepository>
bean:
@Bean
public static SessionRepositoryCustomizer<CoherenceIndexedSessionRepository> sessionRepositoryCustomizer() {
return (sessionRepository) -> {
sessionRepository.setDefaultMaxInactiveInterval(Duration.ofSeconds(120));
};
}