Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-409

Having @Alternatives for resource definition

    XMLWordPrintable

Details

    • Feature Request
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Obsolete
    • TBD
    • None
    • None
    • None

    Description

      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 :

      @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 {...}
      

      And another DS that would be used, let say, in production as an alternative :

      @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 {...}
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            agoncal Antonio Goncalves
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: