设置session超时时间

This commit is contained in:
F嘉阳
2018-02-27 16:12:36 +08:00
parent 81fb9cdff6
commit 97e60b662e
5 changed files with 15 additions and 7 deletions

View File

@@ -1,13 +1,19 @@
package com.fjy.spring.controller; package com.fjy.spring.controller;
import com.fjy.spring.domain.TbUser;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.bind.support.SessionStatus;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import static com.fjy.spring.constant.GlobalConstant.USER_SESSION_KEY;
@Controller @Controller
@SessionAttributes(USER_SESSION_KEY)
public class NavController { public class NavController {
@Resource @Resource
HttpServletRequest request; HttpServletRequest request;

View File

@@ -2,6 +2,8 @@
server: server:
servlet: servlet:
context-path: /cms context-path: /cms
session:
timeout: 1440s
port: 8080 port: 8080
serverproperties: serverproperties:
port_num: 8080 port_num: 8080
@@ -31,4 +33,3 @@ spring:
#resources: #resources:
# static-locations: classpath:/templates/ # static-locations: classpath:/templates/
debug: true debug: true

View File

@@ -2,6 +2,8 @@
server: server:
servlet: servlet:
context-path: /cms context-path: /cms
session:
timeout: 1440s
port: 8081 port: 8081
serverproperties: serverproperties:
port_num: 8081 port_num: 8081
@@ -30,4 +32,3 @@ spring:
#resources: #resources:
# static-locations: classpath:/templates/ # static-locations: classpath:/templates/
debug: false debug: false

View File

@@ -1,4 +1,4 @@
#控制配置文件调用 #控制配置文件调用
spring: spring:
profiles: profiles:
active: dev active: prod

View File

@@ -25,8 +25,8 @@
<!--滚动策略--> <!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径文件名,文件名包含时间--> <!--路径文件名,文件名包含时间-->
<fileNamePattern>F:\JAVA Workspace\Temp\log\%d\info.%d.log</fileNamePattern> <!--<fileNamePattern>F:\JAVA Workspace\Temp\log\%d\info.%d.log</fileNamePattern>-->
<!--<fileNamePattern>/www/cmsfile/%d/info.%d.log</fileNamePattern>--> <fileNamePattern>/www/cmsfile/%d/info.%d.log</fileNamePattern>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
@@ -44,8 +44,8 @@
<!--滚动策略--> <!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径文件名,文件名包含时间--> <!--路径文件名,文件名包含时间-->
<fileNamePattern>F:\JAVA Workspace\Temp\log\error.%d.log</fileNamePattern> <!--<fileNamePattern>F:\JAVA Workspace\Temp\log\error.%d.log</fileNamePattern>-->
<!--<fileNamePattern>/www/cmsfile/%d/error.%d.log</fileNamePattern>--> <fileNamePattern>/www/cmsfile/%d/error.%d.log</fileNamePattern>
</rollingPolicy> </rollingPolicy>
</appender> </appender>