Skip to main content

Posts

Showing posts with the label guice-3

Guice3 Singleton is never instantiated in GAE project

I'm new to Guice and already stuck :) I pretty much copied classes GuiceConfig, OfyFactory and slightly modified Ofy from Motomapia project (which you can browse) using it as s sample. I created GuiceServletContextListener which looks like this public class GuiceConfig extends GuiceServletContextListener { static class CourierServletModule extends ServletModule { @Override protected void configureServlets() { filter("/*").through(AsyncCacheFilter.class); } } public static class CourierModule extends AbstractModule { @Override protected void configure() { // External things that don't have Guice annotations bind(AsyncCacheFilter.class).in(Singleton.class); } @Provides @RequestScoped Ofy provideOfy(OfyFactory fact) { return fact.begin(); } } @Override public void contextInitialized