Session in Spring Boot

  • HTTP is a stateless protocol. All request and responses are independent. The server cannot distinguish between new visitors and returning visitors.
  • But sometimes we may need to keep track of clients activity activity across multiple requests. This is achieved using session management. It is a mechanism used by the web container to store information for a particular user.
  • Sessions are needed to keep the track of clients activity across multiple requests.
  • Session management can be done using following ways.
    • Cookies
    • Hidden from field
    • URL rewriting
    • HTTP session
  • Spring session consist of following modules
  • For storing session in database using JDBC, we use property
    • Spring. Session. Store-type = jdbc 
  • By default, tomcat, stores, HTTP session objects in memory.
  • Using spring session, JDBC we can store all the information in a data store.
  • Specify following property in configuration
    • spring.session.store–type = JDBC.
  • Session are used to manage state between HTTP requests
    • Session ID Is used and is stored in Cookie on client machine.
    • From server side session is managed by server.
  • Spring session, we place the HTTP session implementation by a custom implementation.
  • Spring session creates a been called as sessionRepositoryFilter.

No comments:

Post a Comment

Spring Boot

What is circular/cyclic dependency in spring boot? When two services are interdependent on each other, that is to start one service, we requ...