项目作者: djselzlein

项目描述 :
Example on how to use Spring Session with Redis
高级语言: Java
项目地址: git://github.com/djselzlein/spring-session-redis-demo.git
创建时间: 2017-10-27T15:41:25Z
项目社区:https://github.com/djselzlein/spring-session-redis-demo

开源协议:MIT License

下载


Spring Session Redis Demo Tweet

Build Status

Externalize session information to Redis using Spring projects

  • Spring Data Redis
  • Spring Session
  • Spring Security

What for?

When working on a multi-instance web application, application state must be all externalized from the web servers. Users’ session information are by default stored in-memory by the web servers, such as Wildfly or Apache Tomcat.

In order to resolve this matter the architecture demo implemented here stores session information on Redis (follow the link for more information) so when a web server is down others have access to the sessions this server was handling requests from.

See this blog post for further information.

Setup

Before running this demo, make sure you have Redis running.
You may either install it or run its Docker image.

Default Redis host and port:

  1. 127.0.0.1:6379

Run

  • Clone
  • Run SpringSessionRedisDemoApplication.java

Play

  • Access http://localhost:8080
  • Log in as admin/admin
  • Restart your server
  • Refresh your browser
  • Keep using your session from where you left it