java - 防止应用程序自动注销
问题描述
我正在使用spring boot java web-application,登录后,如果有任何不活动,它会在一段时间后注销,我该如何停止呢?请帮忙。
解决方案
您需要指定会话超时发生多长时间,因为您已经体验到最简单的解决方法是在 WEB-INF 中找到 web.xml 文件并更改或删除给定的超时量。如果由于某种原因它被删除或不存在,请使用以下内容重新制作 WEB-INF 目录中的 web.xml 文件。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>YourWebAppName</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>15</session-timeout>
</session-config>
</web-app>
推荐阅读
- c# - c#restful selfhosted api winforms 适用于我的本地 ip 但不适用于我的 plubic ip 事件和端口重定向
- javascript - 将 CSS 类添加到 JS 脚本并使用按钮触发(夜间模式)
- linux - 从 txt 文件中读取问题并将答案与 Bash 脚本中的另一个 txt 文件进行比较
- html - 悬停在电话号码上时,它会在号码前显示 %E2%80%AD
- bash - 在连续三个运行中超过阈值时 bash 发送邮件
- google-apps-script - Apps 脚本:检查范围是否为空并复制数据
- numpy - sympy lambdify 与 scipy curve_fit
- angular - Angular 库导出模型和库
- ios - 在 Mac 上通过 PAClient.exe 手动运行 PAServer
- java - 关于微服务的 Oauth2 授权类型 client_credentials 用例