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).
/Marcus
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).
/Marcus
No. Can you refactor so that the session-aware behaviour is in an object in the HttpSession, and the controller is still threadsafe?
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?