membersound
membersound

Reputation: 86747

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.

For only one application I want to increase the session timeout. Therefore added the following file:

/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. Why?

Upvotes: 1

Views: 1586

Answers (1)

loicmathieu
loicmathieu

Reputation: 5562

In standard maven project, the WEB-INF folder is in src/main/webapp and not in src/main/resources. The issue can comes from this.

You check your packaged war file for the location of the web.xml file.

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

Upvotes: 2

Related Questions