Spring Boot Java Config Set Session Timeout

后端 未结 3 1926
误落风尘
误落风尘 2020-12-01 06:11

How can I configure my (embedded) Tomcat Session Timeout in a Spring Boot Application?

public class SessionListener implements HttpSessionListener{

@Overrid         


        
相关标签:
3条回答
  • 2020-12-01 06:44

    You should be able to set the server.session.timeout in your application.properties file.

    ref: http://docs.spring.io/spring-boot/docs/1.4.x/reference/html/common-application-properties.html

    0 讨论(0)
  • 2020-12-01 06:59
    • Spring Boot version 1.0: server.session.timeout=1200
    • Spring Boot version 2.0: server.servlet.session.timeout=10m
      NOTE: If a duration suffix is not specified, seconds will be used.
    0 讨论(0)
  • 2020-12-01 07:03

    server.session.timeout in the application.properties file is now deprecated. The correct setting is:

    server.servlet.session.timeout=60s
    

    Also note that Tomcat will not allow you to set the timeout any less than 60 seconds. For details about that minimum setting see https://github.com/spring-projects/spring-boot/issues/7383.

    0 讨论(0)
提交回复
热议问题