[javaee-spec users] Re: [jsr366-experts] Re: Compatibility Problems with MR Resource Annotation Widening

From: Mark Struberg <>
Date: Thu, 5 Mar 2015 14:51:19 +0100

> Am 05.03.2015 um 02:00 schrieb Bill Shannon <>:
> I guess we're reading the spec differently. I read section 3.7 of the CDI
> spec to be describing how to use the existing Java EE resource injection
> capabilities to make those resources available to the rest of CDI using
> CDI dependency injection.

That’s how it is intended. Let’s look at one sample from the spec

private Datasource customerDatabase;

EE will take the resource from the given JNDI location and inject it into the customerDatabase field when the containing contextual instance gets created.
CDI will later treat this field as „Producer Field“. @CustomerDatabase is just a random @Qualifier.

This allows to have a much easier to read code without having to copy the jndi location string all over the place:

public class MyCustomerService {

  private DataSource ds;