diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionProperties.java index f75e44cf3c..6f9cebf67a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionProperties.java @@ -65,8 +65,7 @@ public class SessionProperties { @PostConstruct public void checkSessionTimeout() { if (this.timeout == null && this.serverProperties != null) { - Session session = this.serverProperties.getServlet().getSession(); - this.timeout = (session == null ? null : session.getTimeout()); + this.timeout = this.serverProperties.getServlet().getSession().getTimeout(); } } @@ -87,6 +86,10 @@ public class SessionProperties { return this.timeout; } + public void setTimeout(Duration timeout) { + this.timeout = timeout; + } + public Servlet getServlet() { return this.servlet; } @@ -95,10 +98,6 @@ public class SessionProperties { this.servlet = servlet; } - public void setTimeout(Duration timeout) { - this.timeout = timeout; - } - /** * Servlet-related properties. */ diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 38a2fe917e..860870b865 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -6015,7 +6015,8 @@ the name of the table for the JDBC store, as shown in the following example: ---- For setting the timeout of the session you can use the `spring.session.timeout` property. -If that property is not set, the auto-configuration will fallback to the value of `server.servlet.session.timeout`. +If that property is not set, the auto-configuration fallbacks to the value of +`server.servlet.session.timeout`. [[boot-features-jmx]] == Monitoring and Management over JMX