Announcement Announcement Module
No announcement yet.
Non-singleton Controllers on session level Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Non-singleton Controllers on session level

    Is there a way to specify so that the same Controller instance will be used throughout a session and that other sessions will get new Controller instances (if the url mappings point to the same controller of course).


  • #2
    No. Can you refactor so that the session-aware behaviour is in an object in the HttpSession, and the controller is still threadsafe?


    • #3
      I noticed this post as I'm attempting to code something similar to your suggestion.

      I'm attempting to place an instance of an object (MaintenanceService) into the session. At the moment I'm attempting to use an implementation of the HandlerInterceptorAdapter class to create the instance, if one doesn't already exist, and place it in the session.

      I noticed that the HandlerInterceptorAdapter class doesn't have access to the application context (via something similar to the getApplicationContext() method). And I would think that using DI via the xml mapping files would create a new instance of MaintenanceService for every instance of the HandlerInterceptorAdapter.

      Anyone have any suggestions?