The Artima Developer Community
Sponsored Link

Java Buzz Forum
Dependency Injection Annotations To Come To A JVM Near You.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Dependency Injection Annotations To Come To A JVM Near You. Posted: May 5, 2009 11:58 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Dependency Injection Annotations To Come To A JVM Near You.
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

(Via Twitter, where else?)

Remember this (my blog reaction to Google Guice 1.0)? At the time I wondered:

Me:

Guice, Or Something Like It, Should Be In The JDK

About the only thing that makes feel a little bit uncomfortable is the use of Guice specific imports in my application code.

Wouldn't it be nice if I don't have to do a

import com.google.inject.*;
but do a
import java.lang.inject.*;
instead?

It's been 779 days since then, but Bob Lee and Rod Johnson have just made public a (work-in-progress) JSR JSR ?: Annotations for Dependency Injection "to standardize a proven, non-controversial set of annotations that make injectable classes portable across frameworks."

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>.

Read: Dependency Injection Annotations To Come To A JVM Near You.

Topic: Designers are Building up Virtual Model of 2000 Year old and world's largest Egyptian temple Previous Topic   Next Topic Topic: AOL names former Google exec as head of ad business _ fourth person in the role since 2008

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use