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.

Container Hierarchy

The integration of Webwork2 and PicoContainer (found in NanoContainer) creates a container hierarchy (Application, Session, Request).

Actions are registered in the request container (a new container is created for every request) and therefore can have dependencies on components defined at all levels.

I am not fully sure about the usefullness of the request container vs the potential overhead but I certainly find it usefull to have a container per session.

Actions could be defined as prototypes in the session container (or automatically registered as beans with autowiring?). This allows to have singleton components per session and dependency resolving is done independently of the scope. I suppose this would involve a ServletContextListener to listen for session creation and expiration.

Is it possible do that currently in Spring?
Anyone tried to do something like this?

It wouldn't be hard to do. A listener or handler interceptor could create a new context whose parent was the application context. But why not use a strongly typed session object to hold whatever objects are required for the session? It would seem worrying if large numbers of objects were required to be held in a session...