Bob Lee: Five years ago, Spring 1.0 brought Java dependency injection into the mainstream. Three years later, Google Guice 1.0 introduced annotation-based dependency injection and made Java programming a little easier. Since then, developers have had to choose between a) writing external configuration or b) importing vendor-specific annotations.
Today, we hope to give developers the best of both worlds. Google Guice and SpringSource have partnered to standardize a proven, non-controversial set of annotations that make injectable classes portable across frameworks. At the moment, the set of specified annotations consists of:
@Inject - Identifies injectable constructors, methods, and fields
@Qualifier - Identifies qualifier annotations
@Scope - Identifies scope annotations
@Named - String-based qualifier
@Singleton - Identifies a type that the injector only instantiates once
One additional interface is specified for use in conjunction with these annotations:
Provider<T> - Provides instances of a type T. For any type T that can be injected, you can also inject Provider<T>.