Skip to main content

Posts

Showing posts with the label guice

Google Guice vs. PicoContainer for Dependency Injection

My team is researching dependency injection frameworks and is trying to decide between using Google-Guice and PicoContainer. We are looking for several things in our framework: A small code footprint - What I mean by a small code footprint is we don't want to have dependency injection code litter everywhere in our code base. If we need to refactor down the road, we want it to be as easy as possible. Performance - How much overhead does each framework have when creating and injecting objects? Ease of use - Is there a large learning curve? Do we have to write mounds of code to get something simple working? We want to have as little configuration as possible. Community size - Larger communities usually means that a project will continue to be maintained. We don't want to use a framework and have to fix our own bugs ;) Also any questions we have along the way can (hopefully) be answered by the framework's developer/user community . Comparisons of the two f

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