spring-boot/spring-boot-samples/spring-boot-sample-session
Vedran Pavic 8561929164 Improve Spring Session sample
This commit improves the Spring Session sample by providing multiple
build profiles that make it possible to easily try out different session
stores. By default, JDBC session store backed by an in-memory embedded H2
database is used.

See gh-10351
2017-09-20 11:08:46 +02:00
..
src Improve Spring Session sample 2017-09-20 11:08:46 +02:00
pom.xml Improve Spring Session sample 2017-09-20 11:08:46 +02:00
README.adoc Improve Spring Session sample 2017-09-20 11:08:46 +02:00

= Spring Boot Spring Session Sample

This sample demonstrates the Spring Session auto-configuration support. Spring Session
supports multiple session store types, including:

* `Redis`
* `JDBC`
* `Hazelcast`



== Using a different session store
Initially, the project uses JDBC session store backed by an in-memory embedded H2
database. You can try out your favorite session store as explained below.



=== Redis
Add `org.springframework.session:spring-session-data-redis` and
`spring-boot-starter-data-redis` dependencies to the project and make sure it is
configured properly (by default, a Redis instance with the default settings is expected
on your local box).

TIP: Run sample application using Redis session store using
`$mvn spring-boot:run -Predis`.



=== JDBC
Add `org.springframework.session:spring-session-jdbc`,
`org.springframework.boot:spring-boot-starter-jdbc` and `com.h2database:h2` dependencies
to the project. An in-memory embedded H2 database is automatically configured.

TIP: Run sample application using JDBC session store with
`$mvn spring-boot:run -Pjdbc`.

Note that this profile is active by default.



=== Hazelcast
Add `org.springframework.session:spring-session-hazelcast` and `com.hazelcast:hazelcast`
dependencies to the project to enable support for Hazelcast. Since there is a default
`hazelcast.xml` configuration file at the root of the classpath, it is used to
automatically configure the underlying `HazelcastInstance`.

TIP: Run sample application using Hazelcast session store with
`$mvn spring-boot:run -Phazelcast`.