Matt/ blog/ Guice

So far, I've used Spring exclusively for my DI. However, it is pretty tedious, and since I pretty much only use the explicit binding of Spring, I end up with oodles of XML configuration.

I think I'm going to try Guice for a while and see how it goes. It should streamline my usage of DI (since I started doing similar things with Spring anyway), which would be peachy. It doesn't, however, take care of configuration, which Spring sort of did for me. So I'm watching the tutorial to figure out how to integrate Guice and then use (insert some other tool here) for management of configuration.

I'll post more when I know it.

Updated : I think I now understand the tradeoffs between what I like about Guice and what I like about Spring.

Guice (ratings are on scale of (+) suck (1) to awesome (5), (-) from shucks (1) to FOAD (5)):

Spring (same scale):

I think the primary hesitancy I have with Guice is using their Annotations. However, we've treated the Spring configuration as code for quite a long time now. We have quite a bit of Spring configuration as well, easily more than would be added through simple annotations. Also, Guice seems to allow for building a framework via it's annotations and contexts to make thread safety easier, both by making it more explicit and automated.

Overall, since it seems like you could use Guice for wiring and Spring for the Web Kitchen Sink Framework, or Spring for both, but Guice seems inherently simpler. I'm sold enough to try it out. Now I need a toy project to try it out on. Hmmm.