How to change session timeout for a Spring Boot web application
- Details
- Written by Nam Ha Minh
- Last Updated on 22 July 2024   |   Print Email
server.servlet.session.timeout= # Session timeout in seconds or minutes
For example, add the following line to the application configuration file to change session timeout to 15 minutes:server.servlet.session.timeout=15m
The suffix “m” indicates that session timeout in minutes. If you don’t specify a suffix, Spring Boot will will interpret it as seconds. Let’s see another example:server.servlet.session.timeout=300
This line sets the session timeout to 300 seconds or 5 minutes. It requires restart for the change take effect. NOTES: If your Spring Boot application runs on an external Tomcat server, follow this post to learn how to change session timeout for external Tomcat instance.References:
Related Spring Boot Posts:
Complete Spring Boot Tutorials
About the Author:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Comments