Springboot应用程序会话超时 [英] Springboot app session timeout

查看:112
本文介绍了Springboot应用程序会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个SpringBoot MVC/Security应用程序1.2.2.RELEASE,并且我的application.properties包含服务器设置,例如

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

文档指出

server.session-timeout= # session timeout in seconds

,但

but the ServerProperties.java uses sessionTimeout;

如果您查看我提出的application.properties代码,我已经尝试了独立和一起尝试,但是2分钟后我没有超时,我没有明确编写任何其他代码来执行任何会话处理.

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?

推荐答案

由于某些原因,我不知道仅设置

I don't know for some reason only setting

server.session.timeout=120 

但是,当我同时设置会话超时和cookie的最大使用期限时,它对我不起作用:

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 

效果完美

这篇关于Springboot应用程序会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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