springboot 集成spring-session redis 实现分布式session

gradle 添加依赖 

    compile("org.springframework.session:spring-session:1.3.0.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-data-redis:${springBootVersion}")

application.properties 配置redis信息

# REDIS (RedisProperties)
spring.redis.database= 1
spring.redis.host=localhost 
#spring.redis.password=
spring.redis.port=6379
spring.redis.pool.max-idle=8
spring.redis.pool.min-idle=0
spring.redis.pool.max-active=8  
spring.redis.pool.max-wait=-1  
#spring.redis.sentinel.master=
#spring.redis.sentinel.nodes=

指定session 缓存方式

#指定默认session缓存方式,redis
spring.session.store-type=redis

用RedisDesktopManager 查看redis缓存的session信息

springboot 集成spring-session redis 实现分布式session

 

搞定

 

posted @ 2017-03-24 22:11 Xiao.jf 阅读(...) 评论(...) 编辑 收藏

相关文章:

  • 2019-11-25
  • 2019-02-11
  • 2021-10-03
  • 2021-01-18
  • 2019-07-21
  • 2021-08-01
  • 2021-08-01
  • 2019-01-25
猜你喜欢
  • 2018-04-23
  • 2019-02-18
  • 2018-09-13
  • 2019-02-12
  • 2021-03-09
  • 2018-11-03
  • 2017-11-27
  • 2019-07-10
相关资源
相似解决方案