Hi. The best solution i'm aware of is to use servlet 3.0 programmatic way (via ServletContainerInitializer [1]) to create servlet instances and manage their (Injector effectively) lifecycle from ServletContextListener [2]. This allows you to create immutable (constuctor injection) servlet instances with all the dependencies. Is there something that this model is lacking?
p.s. I use official servlet extension a lot. [1]: http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContainerInitializer.html [2]: http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html 2013/1/29 Simone Tripodi <[email protected]> > Hi all guys, > > everybody here should be already familiar with the 'official' servlet > extension for Guice, which is anyway not just a DI extension but > rather a complete layer on top of Guice. > > Some time ago I - mother of god, 3 years ago already! - I developed my > own servlet extension[1] which is less intrusive - it lets the > container manage the servlets lifecycle and just does the job of > injecting dependencies. > > Do you think it would make sense donating that code to the ASF and > migrate it to the Onami sandbox? > > Thanks in advance for your feedbacks and thoughts! > All the best, > -Simo > > [1] http://injectlet.googlecode.com/svn/site/3.0/index.html > > http://people.apache.org/~simonetripodi/ > http://simonetripodi.livejournal.com/ > http://twitter.com/simonetripodi > http://www.99soft.org/ >
