Spring Boot: Sessions

How to make the stateless HTTP protocol stateful

Sessions, in General

The HTTP protocol is, by design, a stateless protocol.

But in reality, many web applications actually need some state, typically in the form of a User Session

Most web frameworks have some way of maintaining user sessions, and Spring Boot is no exception.

Sessions in Spring Boot

Sessions in Spring Boot can be “backed” by some kind of persistent storage. Some options include:

Why we prefer JDBC/SQL for Spring Sessions in CS56

We don’t want CS56 student to have to have a credit card to do their homework.

Accordingly, we restrict ourselves to the parts of Heroku that do not require entering a credit card.

That includes Heroku Postgres, but leaves our Heroku Redis.

So, while Redis may have some advantages over SQL databases for this purpose, for our purposes in CS56, we will use an SQL database.

References

Related topics: