Issue
I'm looking to extend the user session in a Spring MVC app with Spring boot and Tomcat. Looking at the documentation there seems to be 2 relevant properties:
server.servlet.session.timeout
spring.session.timeout
Most examples out there seem to suggest to use server.servlet.session.timeout
; what is the purpose of spring.session.timeout
? Which one should be used to extend the user session?
Solution
spring.session.timeout
is the property from a Spring sub-project called Spring Session
. It will fallback to server.servlet.session.timeout
if it is not set.
In short , Spring Session allows you to store HttpSession in RDBMS / Redis / Hazelcast Cluster / MongoDB rather than an internal map inside Tomcat .So the sessions is stored in the container agnostic way and make session clustering easier as you do not need to configure a Tomcat cluster.
So if you do not use Spring Session
, you should use server.servlet.session.timeout
Answered By - Ken Chan