繁体   English   中英

spring-boot Web应用程序中未考虑web.xml会话超时?

[英]web.xml session-timeout not taken into account in spring-boot web app?

我有一个war web应用程序是建立与spring-boot-starter-web和运行上tomcat8

对于仅一个应用程序,我想增加会话超时。 因此添加了以下文件:

/src/main/resources/WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

    <session-config>
        <session-timeout>600</session-timeout>
    </session-config>
</web-app>

但是TTL会话超时仍保留默认的30分钟。 为什么?

在标准Maven项目中,WEB-INF文件夹位于src / main / webapp中,而不位于src / main / resources中。 问题可能来自此。

您检查打包的war文件中web.xml文件的位置。

您可以在此处找到示例项目结构: https : //github.com/spring-projects/spring-boot/tree/v1.5.6.RELEASE/spring-boot-samples/spring-boot-sample-traditional

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM