This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
From spring point of view, your bean is not a singleton. You should make it a prototype in the app context and attach an intance to the user session on the login form for example. You can then use an interceptor to read this value before any controller is called and store it in a ThreadLocal and using anotehr interceptor restore this value to the user session.
I need a controller to be singleton in a HTTP session, not in an application context.
You could implement this with a custom TargetSource implementation class, but it depends on the web framework you are using. WebWork for example allows you to get the HttpServletRequest and thus also the session by using ServletActionContext, Echo offers a similar functionality. If you can get the session through such a mechanism inside the TargetSource implementation class, you could retrieve your object from the session if it is available and otherwise get a new prototype from spring and put it in the session.