Spring Session for Apache Geode2.7.0

NOTICE

At the end of 2022, VMware announced the general availability of the Spring for VMware GemFire projects.

While these Spring based projects for VMware GemFire are open source and a succession to the Spring for Apache Geode projects, they are not a replacement. VMware GemFire forked from the Apache Geode project and is not open source.

It is not recommended to begin new projects using Spring for Apache Geode and rather transition to Spring for VMware GemFire, starting here. Alternatively, the Spring portfolio provides first-class integration with other comparable session caching providers. Also, see here.

Finally, keep in mind, Spring for Apache Geode projects are maintained until OSS and commercial support ends. Maintenance only includes CVE and critical fixes. No new features or enhancements will be made. Spring Session for Apache Geode support timelines can be viewed here.

Overview

Spring Session for Apache Geode (SSDG) provides an implementation of the core Spring Session framework using Apache Geode to manage a user’s Session information.

Session state is stored in Apache Geode by leveraging Spring Data for Apache Geode. By integrating with Apache Geode, you have the full power of this technology (Strong Consistency, Low Latency, High Availability, Resiliency, and so on) at your finger tips in your Spring Boot applications.

It is even possible to use SSDG when deploying and running your Spring Boot applications in Pivotal CloudFoundry, using Pivotal Cloud Cache, which is itself based on Apache Geode.

Features

Spring Session for Apache Geode (SSDG) provides the following features:

  • HTTP and WebSocket Session state management using Apache Geode as the backend.

  • Clustered & Distributed Session Management - Improves on the availability and resilience of your system architecture.

  • Strong Consistency - Apache Geode implements strong consistency guarantees, much like a database.

  • Custom Expiration Policies - For example, support for fixed Session timeouts.

  • Custom Data Serialization - Enable the (HTTP) Session state to be serialized other than by Java Serialization so that application classes you put into the Session do not need to implement java.io.Serializable.

  • Custom Change Detection - You can decide whether the Session is dirty or not and what gets sent (e.g. the delta) between your Spring Boot application and the Apache Geode cluster in a client/server topology.

  • Powerful Pub/Sub mechanics - Allows you to register interests or express interests in Session changes based using a query predicate to receive notifications of updates.

Adding Spring Session for Apache Geode to your build

Spring Session for Apache Geode is part of a Maven BOM (Bill of Materials) used to coordinate versions between the core Spring Session projects and this Apache Geode extension. Each BOM release is called a release train and has a naming strategy, for example: Apple-SR9, Bean-SR12, Corn-SR6, Dragonfruit-SR3, 2020.0.7, 2021.0.4, 2021.1.1, 2021.2.0-M1, and 2022.0.0-M1.

Using the BOM with Maven

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.session</groupId>
      <artifactId>spring-session-bom</artifactId>
      <version>2021.1.1</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

Then, you can add the BOM as a dependency to your Spring Boot application Maven POM file:

<dependencies>
  <dependency>
    <groupId>org.springframework.session</groupId>
    <artifactId>spring-session-data-geode</artifactId>
  </dependency>
</dependencies>

Using the BOM with Gradle

Since Gradle has no first-class support for Maven BOMs, you may 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.11.RELEASE'
}

Then use it to import the BOM:

dependencyManagement {
  imports {
    mavenBom 'org.springframework.session:spring-session-bom:2021.1.1'
  }
}

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

dependencies {
  compile 'org.springframework.session:spring-session-data-geode'
}

Spring Boot Config

If you are using Spring Boot, and specifically, Spring Boot for Apache Geode(SBDG), you can include the starter for Spring Session for Apache Geode (SSDG) in your Spring Boot application Maven POM file.

For example:

<dependencies>
  <dependency>
    <groupId>org.springframework.geode</groupId>
    <artifactId>spring-geode-starter-session</artifactId>
    <version>1.6.3.RELEASE</version>
  </dependency>
</dependencies>

See the SBDG Version Compatibility Matrix for more details.

Spring Initializr

Quickstart Your Project

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all