InfoQ Homepage News Dependency Injection for Java

Dependency Injection for Java


For several years both Google and SpringSource have provided dependency injection capabilities via their open source projects named Google Guice and the Spring Framework, respectively for several years. However, until recently there has been no standard, vendor-neutral way for developers to swap between these frameworks, or others, without having to update their source files. But, if things go according to plan some core dependency injection annotations and interfaces will make their way into the Java SDK.

Just a few weeks ago Google announced their partnership with SpringSource to,

standardize a proven, non-controversial set of annotations that make injectable classes portable across frameworks.

 Earlier this week an official proposal, JSR 330: Dependency Injection for Java, was submitted to the JCP (Java Community Process). The proposal does indicate that the JSR targets the Java SE platform, minimally version 5, but aims to lay a foundation that will be useful for dependency injection in Java EE as well. The initial set of proposed annotations include:

  • @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

The entire process, from initial annotations to the submission of the JSR and beyond are said to be open to the public allowing for community feedback throughout. In fact, the community has voiced a lot of opinions on several blogs about the partnership, proposal and even the usefulness of the whole thing.

Included below is a poll to help gauge what the InfoQ community is thinking, so go ahead and vote, the results could be quite interesting.



We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.