Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4572514
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:39:23+00:00 2026-05-21T19:39:23+00:00

I am learning Spring 3 and trying to understand when is HTTPSession created and

  • 0

I am learning Spring 3 and trying to understand when is HTTPSession created and what is the lifecycle. All my controllers are singleton (which is by default) and I have configured a HttpSessionListener. I observed that sessionCreated is never getting invoked.

But when I make my LoginController as Session scoped controller then the sessionCreated gets invoked. I want to know how is the HttpSession managed by spring controllers. Also, another question is lets say first request from borowser comes to LoinController and creates the HttpSession – then does the subsequent requests from that browser to different controller(which is singleton) would be using the same HTTPSession or woule it be stateless? Can someone please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:39:24+00:00Added an answer on May 21, 2026 at 7:39 pm

    Controllers are singleton and stateless. The dispatcher servlet invokes the desired controller method and passes the session to it. The session is obtained by the dispatcher servlet by calling request.getSession(). Since it is s normal servlet, the container “gives” it the request and response that any servlet obtains on each request.

    That said, a servlet is also singleton (it has one instance per context). And multiple threads (= requests) are invoking its methods.

    And a final note – session-scoped beans are rarely needed. In my experience you can have a whole application without any session-scoped beans.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been learning C#, and I'm trying to understand lambdas. In this sample below,
OK... I'm a VB.NET WinForms guy trying to understand WPF and all of its
I am learning OpenXML. I have been looking for hours trying to find how
For learning and demonstrating, I need a macro which prints its parameter and evaluates
I am learning Python and trying to figure out an efficient way to tokenize
i am self-studying asp.net and was trying some small projects to help understand the
I am learning Erlang and I am trying to create a very sample blog
Here's the deal: I'm trying, as a learning experience, to convert a C program
We're learning EJB 3.0 in school and we're trying to determine best practice for
I am learning regular expressions and I am trying find this string day1otlk_XXXX.gif where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.