session大家都知道失效时间大概也就在30分左右,在springboot项目中配置一下也简单,我就直接上代码了=====
在springboot启动类 application.java中加入此配置就可以了:
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》===
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,MybatisAutoConfiguration.class})
@ComponentScan("com.tianrun")
@RestController
public class Application
{
//启动类main方法
public static void main( String[] args ){
SpringApplication.run(Application.class, args);
}
//加入以下配置就行
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer(){
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.setSessionTimeout(1800);//单位为S
}
};
}
}