|
From: bing r. <br...@bn...> - 2004-09-21 09:21:44
|
Hi, This may not be what you want, but I have been fascinated by the jsf-spring project (http://jsf-spring.sourceforge.net) and one of the nice features it provides is to allow me to place Spring beans in the web scopes I like. Of course if you hate jsf.... Bing -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Brian McCallister Sent: Tuesday, September 21, 2004 3:01 AM To: spr...@li... Subject: [Springframework-developer] SpringMVC BeanFactory/Component Scopes I may be wrong in thinking that this doesn't exist in Spring, if I am, please tell me! I cannot find anything though. In the SpringMVC configurator I would like to have scope BeanFactory instances. One, as currently, in the application scope, one in the session, and one in the request. Each factory would have the higher scope as its parent. The primary reason for this is that I would like to have strongly typed session scoped components. public class ThrowAwayFooController { private BarComponent bar; public void setBarComponent(BarComponent bar) { this.bar = bar; } public void doStuff() { bar.setSomeSessionData("wombats!"); } } would sit in the request scope factory as a singleton, the BarComponent (following) public class BarComponent { private String animalType; public void setBarComponent(BarComponent bar) { this.bar = bar; } public void setSomeSessionData(final String animalsType) { this.animalType = animalType; } public String getAnimalType() { return animalType; } } would be in the session scope factory. Later throwaway controllers could also be dependent on BarComponent and receive the same one. This provides a much cleaner way of handling session state than using a flat map, I think. It also allows you to change component scopes by simply moving them to a different factory -- presuming the hierarchy is respected, nothing changes (say a stateful thing becomes stateless so can be moved to the application scope, or vice versa). Thoughts? -Brian ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |