瀏覽代碼

设置session过期时间

master
WendyYang 1 年之前
父節點
當前提交
c04f12d4bb
共有 2 個文件被更改,包括 2 次插入10 次删除
  1. +0
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/App.java
  2. +2
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java

+ 0
- 2
pmapi/src/main/java/com/ningdatech/pmapi/App.java 查看文件

@@ -10,13 +10,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
* @author liuxinxin
*/
@EnableRedisHttpSession
@SpringBootApplication
@EnableAsync
@MapperScan(App.MAPPER_PACKAGES)


+ 2
- 8
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java 查看文件

@@ -2,17 +2,12 @@ package com.ningdatech.pmapi.user.security.auth.config;//package com.ningdatech.

import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.CookieHttpSessionIdResolver;
import org.springframework.session.web.http.DefaultCookieSerializer;

import javax.annotation.PostConstruct;

/**
* <p>
* 设置session的过期时间为一天
@@ -23,8 +18,7 @@ import javax.annotation.PostConstruct;
* @Version 1.0
**/
@Configuration
@RequiredArgsConstructor
@AutoConfigureAfter(RedisHttpSessionConfiguration.class)
@EnableRedisHttpSession
public class RedisSessionConfig {

@Bean


Loading…
取消
儲存