Spring Session Module provides APIs and implementation for managing user session in a web application.
Spring Session Module提供用于管理Web应用程序中用户会话的API和实现。
Spring会议 (Spring Session)
Spring Session consists of following modules:
Spring Session由以下模块组成:
- Spring Session Core: Provides API and core support for session management. Spring Session Core:为会话管理提供API和核心支持。
- Spring Session JDBC: provides session management using relational database. Spring Session JDBC:使用关系数据库提供会话管理。
- Spring Session Data Redis: provides session management implementation for Redis database. Spring Session Data Redis:为Redis数据库提供会话管理实现。
- Spring Session Hazelcast: provides session management support using Hazelcast. Spring Session Hazelcast:使用Hazelcast提供会话管理支持。
Spring会议的好处 (Spring Session Benefits)
- Spring Session decouples session management logic from the application, making it more fault tolerant. Spring Session将会话管理逻辑与应用程序分离开来,从而使其更具容错能力。
- Spring Session keeps user session information in the database, so it’s great to use in a clustered environment with multiple server nodes. We don’t need the sticky session or session replication logic. Spring Session将用户会话信息保留在数据库中,因此,在具有多个服务器节点的集群环境中使用它非常好。 我们不需要粘性会话或会话复制逻辑。
- User session data is not lost if the application crashes. When the application is started again it picks up all the user session data. 如果应用程序崩溃,则用户会话数据不会丢失。 再次启动该应用程序时,它将获取所有用户会话数据。
- It’s easy to switch between session storage software, just by changing some configuration we can switch from using Redis to JDBC. 在会话存储软件之间切换很容易,只需更改一些配置,我们就可以从使用Redis切换到JDBC 。
- Spring is an open source project and easily bootstrapped. If you face any issues, there is a good chance that you will find the solution easily online. Spring是一个开源项目,很容易引导。 如果您遇到任何问题,很有可能会在网上轻松找到解决方案。
Spring Session JDBC示例 (Spring Session JDBC Example)
Let’s create a simple Spring Session JDBC example project. I will us