Spring Session

Spring Session provides an API and implementations for managing a user’s session information.
Features

Spring Session makes it trivial to support clustered sessions without being tied to an application container specific solution. It also provides transparent integration with:

HttpSession - allows replacing the HttpSession in an application container (i.e. Tomcat) neutral way, with support for providing session IDs in headers to work with RESTful APIs

WebSocket - provides the ability to keep the HttpSession alive when receiving WebSocket messages

WebSession - allows replacing the Spring WebFlux’s WebSession in an application container neutral way

Modules

Spring Session consists of the following modules:

Spring Session Core - provides core Spring Session functionalities and APIs

Spring Session Data Redis - provides SessionRepository and ReactiveSessionRepository implementation backed by Redis and configuration support

Spring Session JDBC - provides SessionRepository implementation backed by a relational database and configuration support

Spring Session Hazelcast - provides SessionRepository implementation backed by Hazelcast and configuration support

Adding Spring Session to your build

This project uses a Maven BOM (Bill of Materials) and a release train to coordinate versions, e.g. Apple-SR8, Bean-SR3, etc.
Using the BOM with Maven

With Maven, you need to import the BOM first:

org.springframework.session spring-session-bom Bean-SR8 pom import
This example is using Bean-SR8, but you plug in the release train version you need.

Notice the use of the <dependencyManagement> section and the import scope.

Next, add your dependencies to the project without a :

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

Using the BOM with Gradle

Since Gradle has no first-class support for Maven BOMs, you can use Spring’s Dependency management plugin.

Apply the plugin from Gradle Plugin Portal (update the version if needed):

plugins {
id ‘io.spring.dependency-management’ version ‘1.0.6.RELEASE’
}

Then use it to import the BOM:

dependencyManagement {
imports {
mavenBom ‘org.springframework.session:spring-session-bom:Bean-SR8’
}
}

Finally, add a dependency to the project without a version:

dependencies {
compile ‘org.springframework.session:spring-session-data-redis’
}

Spring Initializr
Quickstart Your Project
Bootstrap your application with Spring Initializr.

发布了1 篇原创文章 · 获赞 153 · 访问量 8407
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 精致技术 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览