This repository contains sample applications that showcase basic Spring Session functionalities across different web stacks and data stores.
The name of each sample application contains the web stack integration it’s based on, and the data store is uses to store sessions. Below is the list of all the provided sample applications:
-
HttpSession
-
Redis
-
JDBC
-
Hazelcast
-
MongoDB
-
Infinispan (3rd party integration)
-
-
WebSession
-
Redis
-
MongoDB
-
Java 17 is required to run the samples.
The project is built using Gradle and uses Gradle Wrapper to take care of downloading the appropriate Gradle version.
Each sample is a Spring Boot based application that can be run using:
-
using the
bootRun
task of the appropriate sample application -
from your IDE by running sample application’s main class
By default, all samples start web server on port 8080
.
$ ./gradlew :sample-httpsession-redis:bootRun
By default, this sample will attempt to connect to Redis running locally at port 6379
.
$ ./gradlew :sample-httpsession-jdbc:bootRun
By default, this sample will attempt to connect to PostgreSQL running locally at port 5432
using database spring_session
, username spring_session
and password spring_session
.
The project contains the JDBC driver for the following RDMBSs:
-
DB2
-
MariaDB
-
MySQL
-
Oracle
-
PostgreSQL
-
SQL Server
$ ./gradlew :sample-httpsession-hazelcast:bootRun
By default, this sample will start an embedded Hazelcast instance.
$ ./gradlew :sample-httpsession-infinispan:bootRun
By default, this sample will start an embedded Infinispan instance.
$ ./gradlew :sample-httpsession-mongodb:bootRun
By default, this sample will attempt to connect to MongoDB running locally at port 27017
.
$ ./gradlew :sample-websession-redis:bootRun
By default, this sample will attempt to connect to Redis running locally at port 6379
.