I have the same exact GuiceServletContextListener in every web project I've
ever worked on lately. Rather than continue to copy/paste the code into each
new project I work on, I thought I should put it in a common library =)
My typical pattern is something along the lines of:
Injector injector = Guice.createInjector(
new ServletModule(),
new Struts2GuicePluginModule(),
new MyModule());
Server server = injector.getInstance(Server.class);
server.run();
With this setup it doesn't make sense to create the Injector in the
GuiceServletContextListener. I think that design really only exists for
running inside of application containers and not for embedded servers like
Jetty, GSE, etc. Hopefully this file can be checked in and others running
embedded servers find it helpful.
Original issue reported on code.google.com by benjamin...@gmail.com on 15 Nov 2011 at 8:12
Original issue reported on code.google.com by
benjamin...@gmail.com
on 15 Nov 2011 at 8:12Attachments: