LoginSignup
1
1

More than 5 years have passed since last update.

spring-boot2系でspring.session.timeoutにserver.servlet.session.timeoutが設定される部分のコード

Posted at
pom.xml
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
    </parent>

色々ぐぐっていると、spring.session.timeoutにはserver.servlet.session.timeoutの値(1系ではserver.session.timeout)が設定される、と書いてある。これってどうやってるんだ? と思ったんで該当部分のコードを読んだ。

SessionProperties
package org.springframework.boot.autoconfigure.session;

@ConfigurationProperties(prefix = "spring.session")
public class SessionProperties {
    // (略)
    public SessionProperties(ObjectProvider<ServerProperties> serverProperties) {
        ServerProperties properties = serverProperties.getIfUnique();
        Session session = (properties == null ? null
                : properties.getServlet().getSession());
        this.timeout = (session == null ? null : session.getTimeout());
    }

なんのことはなく、SessionPropertiesのコンストラクタでtimeoutServerPropertie.getServlet().getSession().getTimeout()の値を設定しているだけであった。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1