Spring Session for VMware GemFire provides an implementation of the core Spring Session framework using VMware GemFire to manage a user’s Session information by leveraging Spring Data for VMware GemFire.

By integrating with VMware GemFire, you have the full power of this technology (Strong Consistency, Low Latency, High Availability, Resiliency, etc.) at your fingertips in your Spring Boot or Spring Data applications.

This reference guide explains how to add the Spring Session for VMware GemFire dependency to your Spring Boot or Spring Data project. Once the dependency has been added, refer to the Spring Boot for Apache Geode Reference Guide and Spring Session for in-depth information about using the dependency.

Add Spring Data for VMware GemFire to a Project

The Spring Session for VMware GemFire dependencies are available from the Pivotal Commercial Maven Repository. Access to the Pivotal Commercial Maven Repository requires a one-time registration step to create an account.

Spring Session for VMware GemFire requires users to add the GemFire repository to their projects.

To add Spring Session for VMware GemFire to a project:

  1. In a browser, navigate to the Pivotal Commercial Maven Repository.

  2. Click the Create Account link.

  3. Complete the information in the registration page.

  4. Click Register.

  5. After registering, you will receive a confirmation email. Follow the instruction in this email to activate your account.

  6. After account activation, log in to the Pivotal Commercial Maven Repository to access the configuration information found in gemfire-release-repo.

  7. Add the GemFire repository to your project:

    • Maven: Add the following block to the pom.xml file:

      <repository>
          <id>gemfire-release-repo</id>
          <name>Pivotal GemFire Release Repository</name>
          <url>https://commercial-repo.pivotal.io/data3/gemfire-release-repo/gemfire</url>
      </repository>
      
    • Gradle: Add the following block to the repositories section of the build.gradle file:

      repositories {
          mavenCentral()
          maven {
              credentials {
                  username "$gemfireRepoUsername"
                  password "$gemfireRepoPassword"
              }
              url = uri("https://commercial-repo.pivotal.io/data3/gemfire-release-repo/gemfire")
          }
      }
      
  8. Add your Pivotal Commercial Maven Repository credentials.

    • Maven: Add the following to the .m2/settings.xml file. Replace MY-USERNAME@example and MY-DECRYPTED-PASSWORD with your Pivotal Commercial Maven Repository credentials.

      <settings>
          <servers>
              <server>
                  <id>gemfire-release-repo</id>
                  <username>MY-USERNAME@example.com</username>
                  <password>MY-DECRYPTED-PASSWORD</password>
              </server>
          </servers>
      </settings>
      
    • Gradle: Add the following to the local (.gradle/gradle.properties) or project gradle.properties file. Replace MY-USERNAME@example and MY-DECRYPTED-PASSWORD with your Pivotal Commercial Maven Repository credentials.

      gemfireRepoUsername=MY-USERNAME@example.com 
      gemfireRepoPassword=MY-DECRYPTED-PASSWORD
      
  9. After you have set up the repository and credentials, add the Spring Session for VMware GemFire dependency to your application.

    For version 1.0.0:

    • Maven: Add the following to your pom.xml file. Replace VERSION with the current version of Spring Session for VMware GemFire available.

      <dependency>
          <groupId>com.vmware.gemfire</groupId>
          <artifactId>spring-session-2.7-gemfire-9.15</artifactId>
          <version>VERSION</version>
      </dependency>
      
    • Gradle: Add the following to your build.gradle file. Replace VERSION with the current version of Spring Session for VMware GemFire available.

      dependencies {
          implementation "com.vmware.gemfire:spring-session-2.7-gemfire-9.15:VERSION"
      }
      

    For version 1.1.0 and later:

    Starting in version 1.1.0, you will be required to “Bring Your Own GemFire,” which will allow for improved flexibility with GemFire patch versions. In addition to the Spring Session for VMware GemFire dependency, you must add an explicit dependency on the desired version of GemFire. The required dependencies will differ for clients and servers.

    For clients:

    • Maven: Add the following to your pom.xml file. Replace VERSION with the current version of Spring Session for VMware GemFire available and GEMFIRE_VERSION with the version of VMware GemFire being used for the project.

      <dependency>
          <groupId>com.vmware.gemfire</groupId>
          <artifactId>spring-session-2.7-gemfire-9.15</artifactId>
          <version>VERSION</version>
      </dependency>
      <dependency>
          <groupId>com.vmware.gemfire</groupId>
          <artifactId>geode-core</artifactId>
          <version>GEMFIRE_VERSION</version>
      </dependency>
      <!--if using continuous queries-->
      <dependency>
          <groupId>com.vmware.gemfire</groupId>
          <artifactId>geode-cq</artifactId>
          <version>GEMFIRE_VERSION</version>
      </dependency>
      
    • Gradle: Add the following to your build.gradle file. Replace VERSION with the current version of Spring Session for VMware GemFire available and GEMFIRE_VERSION with the version of VMware GemFire being used for the project.

      dependencies {
          implementation "com.vmware.gemfire:spring-session-2.7-gemfire-9.15:VERSION"
          implementation "com.vmware.gemfire:geode-core:GEMFIRE_VERSION"
          // if using continuous queries
          implementation "com.vmware.gemfire:geode-cq:GEMFIRE_VERSION"
      }
      

    For servers:

    NOTE: The server dependencies are only required if the user is starting an embedded GemFire server using Spring.

    • Maven: Add the following to your pom.xml file. Replace VERSION with the current version of Spring Session for VMware GemFire available and GEMFIRE_VERSION with the version of VMware GemFire being used for the project.

      <dependency>
          <groupId>com.vmware.gemfire</groupId>
          <artifactId>spring-session-2.7-gemfire-9.15</artifactId>
          <version>VERSION</version>
      </dependency>
      <dependency>
          <groupId>com.vmware.gemfire</groupId>
          <artifactId>geode-server-all</artifactId>
          <version>GEMFIRE_VERSION</version>
          <exclusions>
              <exclusion>
                  <groupId>com.vmware.gemfire</groupId>
                  <artifactId>geode-log4j</artifactId>
              </exclusion>
          </exclusions>
      </dependency>
      
    • Gradle: Add the following to your build.gradle file. Replace VERSION with the current version of Spring Boot for VMware GemFire available and GEMFIRE_VERSION with the version of VMware GemFire being used for the project.

      dependencies {
          implementation "com.vmware.gemfire:spring-session-2.7-gemfire-9.15:VERSION"
          implementation ("com.vmware.gemfire:geode-server-all:GEMFIRE_VERSION"){
              exclude group: 'com.vmware.gemfire', module: 'geode-log4j'
          }
      }
      
  10. Your application is now ready to connect with your GemFire instance.

Reference Guide

For further information, refer to the Spring Boot for Apache Geode Reference Guide and Spring Session reference documentation.

Scroll to top icon