Spring Session - 官方网站的综述、特点、模块、使用翻译

目录

OVERVIEW综述

Features特点

Modules模块

Adding Spring Session to your build 在Build中添加Spring Session

Using the BOM with Maven 与Maven一起使用BOM


OVERVIEW综述

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

    Spring Session提供了用于管理用户会话信息的API和实现。

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:

 

    Spring Session使支持集群session会话变得非常简单,无需绑定到特定于应用程序容器的解决方案。
    它还提供了透明的集成:

  • 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

        HttpSession - 允许以中立的方式替换应用程序容器(即Tomcat)中的HttpSession,并支持在头文件中提供会话ID来使用RESTful API

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

        WebSocket - 提供在接收WebSocket消息时保持HttpSession活动的能力

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

        WebSocket - 允许以与应用程序容器无关的方式替换Spring WebFlux的WebSession

Modules模块

    Spring Session consists of the following modules:

    Spring Session由以下模块组成:

  • Spring Session Core - provides core Spring Session functionalities and APIs

        Spring Session Core - 提供核心的Spring会话功能和api

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

        Spring Session Data Redis - 提供SessionRepository和ReactiveSessionRepository实现,支持Redis和配置

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

        Spring Session JDBC - 提供由关系数据库和配置支持所支持的SessionRepository实现

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

        Spring Session Hazelcast - 提供由Hazelcast和配置支持所支持的SessionRepository实现

Adding Spring Session to your build 在Build中添加Spring Session

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

     该项目使用Maven BOM(物料清单)和火车发版来协调版本,如Apple-SR8、Bean-SR3等。

Using the BOM with Maven 与Maven一起使用BOM

 With Maven, you need to import the BOM first:

 使用Maven,需要先导入BOM:

 <dependencyManagement>

  <dependencies>

    <dependency>

      <groupId>org.springframework.session</groupId>

      <artifactId>spring-session-bom</artifactId>

      <version>Bean-SR8</version>

      <type>pom</type>

      <scope>import</scope>

    </dependency>

  </dependencies>

</dependencyManagement>

  • This example is using Bean-SR8, but you plug in the release train version you need.

  • 本例使用的是Bean-SR8,但是您需要插入您需要的发布培训版本。
  • Notice the use of the <dependencyManagement> section and the import scope.

  • 请注意<dependencyManagement>部分和导入范围的使用。

     Next, add your dependencies to the project without a <version>:

     接下来,在没有<version>的情况下将依赖项添加到项目中:

<dependencies>

  <dependency>

    <groupId>org.springframework.session</groupId>

    <artifactId>spring-session-data-redis</artifactId>

  </dependency>

 

</dependencies>

    Using the BOM with Gradle

    在Gradle中使用BOM

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

    因为Gradle对Maven BOMs没有一流的支持,所以你可以使用Spring的依赖管理插件。

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

    应用来自Gradle plugin Portal的插件(如果需要更新版本):

plugins {

  id 'io.spring.dependency-management' version '1.0.6.RELEASE'

 

}

    Then use it to import the BOM:

    然后用它来导入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'

}

 

 


 

posted @ 2020-03-16 20:44  厸清扬  阅读(468)  评论(0编辑  收藏  举报