Thanks very much for your advice, Christian. I'll try the refactoring and see how it works out.
Cheers, Jonathan On Apr 19, 1:07 pm, Christian Edward Gruber <[email protected]> wrote: > Can I beg you not to do this, despite what others may suggest about > how this is possible. It's such a very bad practice that seems to be > prevalent in guice (depend something of wide scope on something of > narrow scope by depending on its provider). > > I would recommend, instead, that you not put your code mostly in the > servlet, but use the servlet to get some sort of action object which > has the logic you were going to put on the servlet from the container, > and make it request scoped if it depends on request-scoped things. > The servlet, then, is merely dispatch. > > Having a Singleton depend on something in the session is just a great > way to make your code seem magical and failures less obvious. > > Christian. > > On Apr 19, 2010, at 7:31 AM, Jonathan wrote: > > > I have a servlet annotated as @Singleton, and a Provider<Foo> that I'm > > injecting into the servlet's constructor. A Foo is generated based on > > information in the current ServletRequest. > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/google-guice?hl=en. -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
