[cdi-dev] [JBoss JIRA] (CDI-409) Having @Alternatives for resource definition

Antoine Sabot-Durand (JIRA) issues at jboss.org
Mon Jun 29 12:39:06 EDT 2015


     [ https://issues.jboss.org/browse/CDI-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Sabot-Durand updated CDI-409:
-------------------------------------
    Issue Type: Feature Request  (was: Bug)


> Having @Alternatives for resource definition
> --------------------------------------------
>
>                 Key: CDI-409
>                 URL: https://issues.jboss.org/browse/CDI-409
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>    Affects Versions: TBD
>            Reporter: Antonio Goncalves
>
> Java EE 6 introduced @DataSourceDefinition and Java EE 7 introduced the same way of defining other resources (JMS factory/destination, Mail factory, JCA connectors....). 
> It would be interesting to have @Alternatives working with these resource definitions. For example you could have a default DS for development : 
> {code}
> @DataSourceDefinition(
>         className = "org.apache.derby.jdbc.EmbeddedDataSource",
>         name = "java:global/jdbc/devDS",
>         user = "dev",
>         password = "dev",
>         databaseName = "dev",
>         properties = {"connectionAttributes=;create=true"}
> )
> public class DevResources {...}
> {code}
> And another DS that would be used, let say, in production as an alternative :
> {code}
> @Alternative
> @DataSourceDefinition(
>         className = "org.apache.derby.jdbc.EmbeddedDataSource",
>         name = "java:global/jdbc/prodDS",
>         user = "prod",
>         password = "prod",
>         databaseName = "prod",
>         properties = {"connectionAttributes=;create=true"}
> )
> public class ProdResources {...}
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the cdi-dev mailing list