Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-529

Attach an annotation marker(s) with @Component to remove ambiguities of injection within a component.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.1.0.0, 5.0.18
    • 5.2
    • tapestry-core
    • None

    Description

      Sometimes a component doesn't know which instance of a common interface is going to be used at design time; the appropriate instance of a common interface will be injected at runtime. For example, a JDBCTable component is using a DataSource:

      public class JDBCTable {
      @Inject
      private DataSource dataSource;

      @Parameter(required = true, defaultPrefix = "literal")
      private String table;
      ....
      }

      When there are multiple DataSource existing, it seems hard to inject a DataSource I wanted into this component, a possible way is to make dataSource a parameter.

      It would be nice that Tapestry 5 can remove this kind of ambiguities of injection by attaching an annotation marker(s) with @Component, as

      @Oracle
      @Component
      private JDBCTable jdbcTable;

      The @Oracle should has higher priority than the one(s) already defined in the component.

      Attachments

        Activity

          People

            Unassigned Unassigned
            xhfdc Yunhua Sang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: