- Blog Xebia France - -
Posted By Guillaume Carre On Lundi May 11th, 2009 17:46 IN J2EE, Popular dance 2 Comments
Quite a lot of noise last week in the blogosphere Popular dance with the announcement by Google and SpringSource of a new proposal of JSR devoted to the injection of dependency: @Inject ("Annotations for Dependency Injection").
As underlines it ' Crazy ' bobsleigh Lee, the main author of , the exit of Spring 1.0, already 5 years ago, brought the injection of dependency in masses, via a file of possessing shape. 3 years ago, Google Guice offered the same thing via annotations (and SpringSource offers the same thing since Spring 2.5).
If the success of Google Guice is limited enough facing the tidal wave Spring, the official report is there: a standard is missing. As both bookshops are not compatible, if you display to another plan / team a bookshop containing dependency injected by Google Guice, and than the other team uses Spring, she will have to redefine all beans and their dependency in a file of shape Spring (or of annotations Spring).
@Inject offer therefore to standardise annotations, to return portable on different frameworks (Guice, Spring, TAPESTRY IOC, etc.) injectable classes.
Another JSR who speaks about injection of dependency has already crossed the stadium of proposal, , ex-web Beans, range especially by Gavin King de Red Hat, author of Hibernate. JSR 299 goes much more far (too much?) that the injection of dependency, subject approached in previous reviews of the papers.
JSR 299 has already a lot made speak about her, because she was recently altered, to be included on time into Popular dance EE 6 (specification of which must be ended in 3 months). You can read comments on our review of the papers of January 26th of this year, in which we were surprised at the absence of SpringSource in JSR 299.
Some extracts of these comments:
Emmanuel Bernard (JBoss):"... SpringSource has never asked to be part of the group of expertise..."
Emmanuel Bernard:"... JBOSS spent a huge time to construct JSR 299..."
Antonio Goncalves (Popular dance EE 6 expert Group): "JSR 299 is not radically transformed, I would say rather than she reduces her sails and concentrates on her initial purpose: a context unified between EJBS and JSF..."
Cyrille Le clerk (Xebia): "JSR who is radically transformed, so as to change name, during the stage of public Review, after two and a half years of intensive job, it parried me exceptional and not very reassuring..."
It is in this context that Google and SpringSource decide to offer @Inject. Intention is legitimate, and both actors are unquestionably the most experienced about the injection of dependency. He indeed seems much easier for Guice, Spring or other framework to implement JSR of the size of possible JSR @Inject, while they are seen wrong implementing JSR 299 fast. Google and SpringSource suggests therefore JSR 299 specifying no more injection of dependency, and reusing annotations defined in @Inject (extract of proposal: "Defining JSR 299 simple percentage has injection Dependency framework for Popular dance EE, and might support these annotations.").
On the other hand timing really seems to us badly chosen: this specification is offered in four months of the validation of Popular dance EE 6 (September, 2009). It seemed already complicated for JSR 299 (of which one still did not vote for inclusion with Popular dance EE 6), and @Inject adds very late his grain of salt.
Even if Bob Lee thinks to be able to make validate @Inject by JCP in five months, or less as part of Popular dance EE 6, he is unlikely qu' @Inject is part of Popular dance EE 6; they have never seen consensual JSR validated so fast, how would make polemical JSR? JSR 299 Makes as for her facing a more and more gripped planning. The result of shopping is peremptory: they "risk therefore " seeing arriving a specification Popular dance EE 6 without JSR of injection of dependency.
Except Gavin King (JSR 299 - JBOSS) and Bob Lee (@Inject - Google) who fiercely discussed the blogosphere, the members of the expert groups of JSR 299 and Popular dance EE 6 remained silent as Rod Johnson, co-initiator of @Inject (who was undoubtedly ).
Finally, I suggest you taking some minutes to read the "rough draught" of proposal of JSR @Inject. They see many names known and admitted among the supporters of this JSR (there Joshua Bloch, Paul Hammant - ThoughtWorks and PicoContainer founder, Doug Lea, Tim Peierls, James Strachan, Hani Suleiman, Jason van Zyl - Maven Plexus, Thiago H de Paula Figueiredo - TAPESTRY IOC). @Inject offer no that to standardise annotations, and does not describe the way dependency is going to be solved, it will be supported by container. The functional perimetre of proposal is therefore very focalized.
For recall, even if no JSR of injection of dependency is included in future into Popular dance EE 6, you have the right to inject your dependency to you even, without Spring, without Guice, for example with a simple constructor Popular dance!
What will allow you to inject corks or mocks since your unit tests there.
Article printed from Blog Xebia France:
URL to article: / 2009 / 05 / 11 / inject-standardisation-de-linjection-de-dependances /
Click here to print.