Author: Sebastian Łaskawiec
Level: Intermediate
Technologies: Infinispan, Spring Boot, Spring Session
Summary: The spring4-session-jdg
quickstart demonstrates how to use Infinispan in a Spring application and integration with session container.
Target Product: JDG
Product Versions: JDG 7.x
Source: https://github.com/infinispan/jdg-quickstart
The spring4-session-jdg
quickstart shows how to use Infinispan with Spring Boot and
Spring Session.
The project can be ran using standalone mode (Spring Boot can use embedded Tomcat container) or can be deployed on JWS/Tomcat installation.
Spring Session provides transparent mechanism for storing sessions (e.g. created in Servlet
s) in custom database. In case
of this demo, this will be an Embedded JBoss Data Grid instance (but you can easily switch to a remote one if you wish).
All you need to build this project is Java 8.0 (Java SDK 1.8) or better, Maven 3.0 or better.
JWS/Tomcat installation is optional.
If you have not yet done so, you must Configure Maven before testing the quickstarts.
Type this command to build the quickstart:
mvn clean package
Run Spring Boot together with embedded Tomcat container by running
mvn spring-boot:run
Navigate to http://localhost:8080/sessions and refresh browser a couple of times. Note the new sessions are created and stored into the Grid.
Build the application using the following command
mvn package
Deploy it to JWS/Tomcat using your favorite technique and navigate to http://localhost:8080/infinispan-spring-session/sessions. Now refresh browser a couple of times. Note the new sessions are created and stored into the Grid.