Spring JavaConfig
Today, I’ve had the opportunity to test Guice on a real project. I must say that the developers really pushed the idea of statically typed IoC very far.
However, trying to port my code from Spring to Guice, I couldn’t easily use a properties file for external configuration. Dealing with multiple beans of same type was also not that simple : you either write your own annotations (a bit tedious) or rely on named beans, loosing compile time checks on the way. (For a large project, I would definitly choose the annotations.) Still Guice is quite impressive.
To be fair to Spring, I also gave a try to Spring’s JavaConfig. So far, I just tested it quickly to explain how it works during Spring training I give. End result : I love it ! You get all Spring benefits over Guice and also get some Guice benefits over Spring : Static typing, properties files, no more XML, refactoring friendly, statically typed named beans, all configuration in one place, no annotations in the code, … Very impressed !
I’ll give a second chance to Guice later on, because I realyze that being a decent Spring user made the transition to Guice more difficult than the transition to JavaConfig.
David,
Glad to hear you like what you’ve seen so far! Don’t hesitate to weigh in on the forums or via JIRA if there are any improvements you’d like to see.
- Chris Beams
Sr. Consultant, SpringSource
http://springsource.com
David,
Guice can handle your properties files, and it’ll be even better in 2.0. Don’t hesitate to post suggestions on the user’s list if there are any features you’d like to see.
– Jesse Wilson
Sr. Software Engineer, Google
http://code.google.com/p/google-guice/
Thanks Chris, Thanks Jesse,
At least Guice and Spring are equal on community support !