4 ms·
On top of dependency injection out of the box Spring offers a lot more, like: Transaction Management, an MVC framework, JDCB templates, ...
by sgolestane 14y ago
On top of dependency injection out of the box Spring offers a lot more, like: Transaction Management, an MVC framework, JDCB templates, ...
- peeters 14y agoThe key phrase there being "out of the box". Guice does great transaction management, just pull in guice-persist. It integrates with servlets cleanly, just pull in guice-servlet. The difference is mainly that Guice tries to be a library and Spring tries to be a framework. I, for one, like knowing that I'm not pulling in "the world" just to get dependency injection. Guice at its core does one thing, and one thing well: dependency injection (and by extension, AOP). It does dependency injection far better than any Spring version I've used (see: constructor injection).
- Radu 14y agoYes, but sooner or later guice won't be enough and you'll use a framework anyway; then the integration mess begins. With the configuration in code/profiles in Spring 3.1 I don't see any real-world advantage to using guice.
- peeters 14y agoAbsolutely not. When core Guice "isn't enough", I just grab one of the many great tools that integrate with Guice (Jersey is one example). My DI tool remains my DI tool, and I use a library that provides bindings for it.