users@javaee-spec.java.net

[javaee-spec users] Re: [jsr342-experts] Implicit Producers

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Wed, 11 Apr 2012 18:57:41 +0200

@David isn't implicit producers the idea behind havinf "default" (or
implicit) resources such as DataSource or JMSFactories (cf. previous emails
about this topic) ?

@Nigel, that sounds like JAX-RS that needs to inject the url information
context using the @Context (instead of the @Inject which is a shame) :

@Context
private UriInfo uriInfo;

It would be nice to homogenise all these injection points

Antoino


On Wed, Apr 11, 2012 at 16:49, Nigel Deakin <nigel.deakin_at_oracle.com> wrote:

> Over on the JMS 2.0 expert group we have identified the need to inject a
> new kind of object called a JMSContext (which wraps a JMS Connection and
> various other objects).
>
> We are looking to define this in a way which is consistent with the way
> that objects are being injected elsewhere in the Java EE platform whilst
> using the specific annotations, and the specific scope, required by JMS.
>
> We could approach this as defining a "implicit producer" which is plugged
> into the platform on some standard way. Applications would use an @Inject
> annotation for injecting JMSContext objects.
>
> (Would this approach mean that application would need to define a
> META-INF/beans.xml file to be able to use injection?)
>
> Alternatively we could do our own thing and simply define the annotation
> and behaviour we require, write it into the JMS spec, and leave it to the
> Java EE vendor to implement it. This seems to be the JPA approach for using
> the @PersistenceContext annotation for injecting EntityManager objects. JMS
> could do something similar, defining, say, a @MessagingContext annotation
> for injecting JMSContext objects.
>
> In my discussions with Java EE experts so far I've got the impression that
> Java EE components have a pretty free hand to decide how their objects are
> injected. However I'd be very interested if the platform was moving towards
> defining a more standard way of supporting injection in Java EE
> applications.
>
> Nigel
>
> (JMS spec lead)
>
>
>
> On 11/04/2012 04:26, David Blevins wrote:
>
>> Another concrete topic on aligning things (noticed this in some of the
>> matrices).
>>
>> Many times it has come up that we want to make more things injectable via
>> @Inject at the platform level. I'm totally
>> on board with that and have been doing some of the suggesting.
>>
>> I've started mentally calling them "implicit" producers as effectively
>> what we're doing is adding producers to
>> applications that weren't explicitly created by the application.
>>
>> As a large number of applications in existence will already have producer
>> methods or fields that produce various
>> JavaEE resources currently only available via @Resource, @EJB, etc. there
>> is a bit of a compatibility issue.
>>
>> Even if we add producers with full spec-standard qualifiers, any existing
>> injection points that do not use qualifiers
>> become ambiguous.
>>
>> It would be great to hear some thoughts on how to solve that.
>>
>>
>> -David
>>
>>


-- 
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org> |
Twitter<http://twitter.com/agoncal>|
Blog <http://feeds.feedburner.com/AntonioGoncalves> |
LinkedIn<http://www.linkedin.com/in/agoncal>| Paris
JUG <http://www.parisjug.org>