Spring Boot Java配置设置会话超时 [英] Spring Boot Java Config Set Session Timeout

查看:496
本文介绍了Spring Boot Java配置设置会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Spring Boot应用程序中配置(嵌入式)Tomcat会话超时?

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

public class SessionListener implements HttpSessionListener{

@Override
public void sessionCreated(HttpSessionEvent se) {
    se.getSession().setMaxInactiveInterval(5*60);
}

@Override
public void sessionDestroyed(HttpSessionEvent se) {

}}

我有一个SessionListener,但是我不知道必须在哪个类中将此监听器添加到上下文中.

I have a SessionListener but I have no idea in which class I have to add this Listener to the Context.

推荐答案

您应该能够在application.properties文件中设置server.session.timeout.

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

这篇关于Spring Boot Java配置设置会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆