...
How do they compare? Several articles have been written comparing Spring and Guice, as well as all three. As many have pointed out, Spring and Guice are more than DI frameworks. For our purposes, we should consider the attributes of each that are most relevant to the problem at hand:
| Spring | PicoContainer | Guice |
---|---|---|---|
Supports start/stop lifecycle hooks for components | Yes (interface or xml-configured) | Yes (interface or annotation) | ? |
Requires component coupling to framework | No | Yes | Yes |
Supports external wiring (outside of code) | Yes (xml) | ? | ? |
OSGi-Friendly | Yes (Spring-DM ) | ? | Yes (Guice-Peaberry) |
JSR-330 Support |