spring-session-data-redis 实现分布式或集群下session共享

spring-session-data-redis 实现分布式或集群下session共享

pom.xml



    org.springframework.session
    spring-session-data-redis


    redis.clients
    jedis

启动类

@SpringBootApplication
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 300)
public class SessionApplication {

    public static void main(String[] args) {
        SpringApplication.run(SessionApplication.class, args);
    }
    @Bean
    public JedisPool redisPoolFactory() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        return new JedisPool(jedisPoolConfig, "127.0.0.1", 6379, 2000, "redisadminxinmon");
    }
}

你可能感兴趣的:(spring-session-data-redis 实现分布式或集群下session共享)