Commit 59b6544f by naan1993

增加一个属性控制session失效时间

parent f3ebc991
...@@ -28,17 +28,19 @@ public class GunsProperties { ...@@ -28,17 +28,19 @@ public class GunsProperties {
private Boolean haveCreatePath = false; private Boolean haveCreatePath = false;
private Integer sessionInvalidateTime = 10 * 60; //session 失效时间(默认为10分钟 单位:秒)
public String getFileUploadPath() { public String getFileUploadPath() {
//如果没有写文件上传路径,保存到临时目录 //如果没有写文件上传路径,保存到临时目录
if(isEmpty(fileUploadPath)){ if (isEmpty(fileUploadPath)) {
return getTempPath(); return getTempPath();
}else{ } else {
//判断有没有结尾符,没有得加上 //判断有没有结尾符,没有得加上
if(!fileUploadPath.endsWith(File.separator)){ if (!fileUploadPath.endsWith(File.separator)) {
fileUploadPath = fileUploadPath + File.separator; fileUploadPath = fileUploadPath + File.separator;
} }
//判断目录存不存在,不存在得加上 //判断目录存不存在,不存在得加上
if(haveCreatePath == false){ if (haveCreatePath == false) {
File file = new File(fileUploadPath); File file = new File(fileUploadPath);
file.mkdirs(); file.mkdirs();
haveCreatePath = true; haveCreatePath = true;
...@@ -66,4 +68,12 @@ public class GunsProperties { ...@@ -66,4 +68,12 @@ public class GunsProperties {
public void setSwaggerOpen(Boolean swaggerOpen) { public void setSwaggerOpen(Boolean swaggerOpen) {
this.swaggerOpen = swaggerOpen; this.swaggerOpen = swaggerOpen;
} }
public Integer getSessionInvalidateTime() {
return sessionInvalidateTime;
}
public void setSessionInvalidateTime(Integer sessionInvalidateTime) {
this.sessionInvalidateTime = sessionInvalidateTime;
}
} }
...@@ -7,6 +7,7 @@ guns: ...@@ -7,6 +7,7 @@ guns:
swagger-open: true #是否开启swagger (true/false) swagger-open: true #是否开启swagger (true/false)
kaptcha-open: false #是否开启登录时验证码 (true/false) kaptcha-open: false #是否开启登录时验证码 (true/false)
#file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) #file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录)
session-invalidate-time: 600 #session失效时间 单位:秒
################### 项目启动端口 ################### ################### 项目启动端口 ###################
server: server:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment