Springboot应用程序会话超时 [英] Springboot app session timeout
问题描述
我创建了一个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屋!