Skip to main content

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

  • From: Nigel Deakin <nigel.deakin@...>
  • To: users@...
  • Subject: [javaee-spec users] Re: [jsr342-experts] Implicit Producers
  • Date: Wed, 11 Apr 2012 15:49:09 +0100

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



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

David Blevins 04/11/2012

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

Pete Muir 04/11/2012

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

Reza Rahman 04/11/2012

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

David Blevins 04/11/2012

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

Nigel Deakin 04/11/2012

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

Antonio Goncalves 04/11/2012

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

Adam Bien 04/15/2012

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

David Blevins 04/19/2012
 
 
Close
loading
Please Confirm
Close