[javaee-spec users] Re: [jsr342-experts] Re: Re: Datasources and other resources defined on CDI beans

From: <>
Date: Mon, 9 Jan 2012 15:02:55 +0000 (GMT)
+ 1.

Jan 9, 2012 03:46:58 AM, wrote:
Java EE needs greater integration at some corners. I think CDI is the perfect technology to do this (I might me wrong here). This is for Pete (and the CDI 1.1 EG) to answer but I feel CDI should stay the pluggable EE technology that it already is, but at the same time become more and more the cement of EE specifications.

On Fri, Jan 6, 2012 at 21:45, Bill Shannon <> wrote:
We've discussed this with Pete.  There's currently a problem because the
processing of platform-defined annotations occurs at a different level
than the processing of CDI-defined annotations.  Thus, at the time the
@DataSourceDefinition annotation is being processed, there's no knowledge
of CDI and in particular of CDI alternatives.

The fix isn't obvious.  Do we delegate processing of all platform annotations
to CDI?  Do we embed greater knowledge of CDI in the processing of platform
annotations?  Either way, it implies a much tighter coupling of CDI with the
rest of the platform.  Can CDI remain a "pluggable" technology and still be
that tightly integrated?

Antonio Goncalves wrote on 01/06/12 11:16:
I will file an issue but the purpose of my email was really to have @Alternative
on a @DataSourceDefinition (and JMS definitions in the future). Something that
sounded obvious to me (having several alternatives definitions) is not possible
in CDI 1.0. Hope it will be in 1.1.

On Fri, Jan 6, 2012 at 19:37, Pete Muir <>> wrote:

   If you file an issue at we can add
   some tests to the CDI TCK for @DataSourceDefinition.

   On 6 Jan 2012, at 18:35,> wrote:

    > Although, if I recall correctly there was no TCK test for this...
    > Jan 6, 2012 01:32:22 PM,> wrote:
    > It's basically a bug I think -- we implemented what you are looking for
   in Resin. I think the Java EE platform spec is pretty clear about
   @DataSourceDefinition on plain managed beans, Servlets, EJB.
    > Jan 6, 2012 03:05:45 AM,> wrote:
    > Hi all,
    > I just came accross a limitation (bug) of GlassFish : adding a
   @DataSourceDefinition on a CDI bean doesn't work in an embedded environment
   I had to put it in the EJB to make it work.
    > Why do I use  @DataSourceDefinition on a CDI bean instead of an EJB ?
   Because I thought I could use alternatives (i.e. defining several data
   sources depending on the environment). But this doesn't work in CDI 1.0
    > Alternatives should work on definitions, don't you think ? In other
   specs, are you aware of other kind of definitions (I know that JMS 2.0 will
   bring similar features with @JMSConnectionFactoryDefinition and
   @JMSDestinationDefinition) ? If yes, we should encourage the spec leads to
   use similar behavior.
    > My 2 cents
    > --
    > Antonio Goncalves
    > Software architect and Java Champion
    > Web site | Twitter | Blog | LinkedIn | Paris JUG

Antonio Goncalves
Software architect and Java Champion

Web site <> | Twitter
<> | Blog
<> | LinkedIn
<> | Paris JUG <>

Antonio Goncalves
Software architect and Java Champion

Web site | TwitterBlog | LinkedInParis JUG