Springboot app session timeout

victor picture victor · Mar 18, 2015 · Viewed 25.7k times · Source

I have created a SpringBoot MVC/Security app 1.2.2.RELEASE and my application.properties contains server settings like

#Tomcat port and contextPath details
server.port=8080
server.contextPath=/test
#server.session-timeout=120
server.sessionTimeout=120

The documentation states

server.session-timeout= # session timeout in seconds

but the ServerProperties.java uses sessionTimeout;

If you look at the application.properties code I have posed, I have tried both independently and together, but I don't get timed out after 2 minutes, I don't have any other code explicitly written to perform any session handeling.

Has anyone come across this issue? What am I missing or doing wrong?

Answer

Manish Kothari picture Manish Kothari · Jun 22, 2016

I don't know for some reason only setting

server.session.timeout=120 

didn't work for me however, when I set both session timeout and cookie max age like below:

server.session.cookie.max-age=120
server.session.timeout=120 

it works perfectly