OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-11-10 6cbfebcada8b005e601b16e500e67fb3846075c3
src/main/java/kr/wisestone/owl/config/AppConfiguration.java
@@ -1,8 +1,15 @@
package kr.wisestone.owl.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.session.data.redis.RedisOperationsSessionRepository;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
/**
 * Created by jeong on 2017-08-01.
@@ -10,6 +17,18 @@
@Configuration
@ComponentScan(basePackages = "kr.wisestone.owl")
@MapperScan(basePackages = "kr.wisestone.owl.mapper")
public class AppConfiguration {
@EnableRedisHttpSession
public class AppConfiguration implements ApplicationListener {
    @Value("${spring.session.timeout}")
    private Integer maxInactiveIntervalInSeconds;
    @Autowired
    private RedisOperationsSessionRepository redisOperation;
    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof ContextRefreshedEvent) {
            redisOperation.setDefaultMaxInactiveInterval(maxInactiveIntervalInSeconds);
        }
    }
}