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.
Hi all,
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 (
https://issues.jboss.org/browse/CDI-53).
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