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. */ @Configuration @ComponentScan(basePackages = "kr.wisestone.owl") @MapperScan(basePackages = "kr.wisestone.owl.mapper") @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); } } }