简体   繁体   English

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

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

I have a war webapp that is build with spring-boot-starter-web and runs on a tomcat8 . 我有一个war web应用程序是建立与spring-boot-starter-web和运行上tomcat8

For only one application I want to increase the session timeout. 对于仅一个应用程序,我想增加会话超时。 Therefore added the following file: 因此添加了以下文件:

/src/main/resources/WEB-INF/web.xml : /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>

But the TTL session timeout still remains the default 30 mins. 但是TTL会话超时仍保留默认的30分钟。 Why? 为什么?

In standard maven project, the WEB-INF folder is in src/main/webapp and not in src/main/resources. 在标准Maven项目中,WEB-INF文件夹位于src / main / webapp中,而不位于src / main / resources中。 The issue can comes from this. 问题可能来自此。

You check your packaged war file for the location of the web.xml file. 您检查打包的war文件中web.xml文件的位置。

You can find an exemple project structure here : https://github.com/spring-projects/spring-boot/tree/v1.5.6.RELEASE/spring-boot-samples/spring-boot-sample-traditional 您可以在此处找到示例项目结构: 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