Configuring HTTP Session timeout in Spring Boot applications

You can configure HTTP Session Timeout for Spring Boot Applications in two ways:

Configuring Session Timeout in

The simplest option is to include in your the parameter server.servlet.session.timeout. For example:


Also note that Tomcat will not allow you to set the timeout any less than 60 seconds.

Configuring Session Timeout Programmatically

Let’s say we want that our HttpSession last only two minutes. To make this happen, we can add to our WebConfiguration class an EmbeddedServletContainerCustomizer Bean with the following content:

Read more

How to disable web server configuration in Spring Boot ?

Spring Boot automatically starts an application in web server mode if it finds the web starter module in the classpath. To disable web server configuration, set the webApplicationType to none in the file as in this example: spring.main.web-application-type=none Copy

Configure Spring Boot to use Jetty Server

By default, Spring boot uses Tomcat as embedded Web server. There are, however, other available Web servers in case you need some specific features. In this tutorial we will learn how to use Jetty as Web Server. Add spring-boot-starter-jetty dependency You will need to update pom.xml and add dependency for spring-boot-starter-jetty. Also, you will need … Read more