• Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.5
    • Fix Version/s: 5.0.6
    • Component/s: tapestry-ioc
    • Labels:


      Currently in IoC, when injecting a service, you are limited to two options:

      • Inject by type, assuming exactly one match
      • Inject by explicit service id

      In a fully featured system both of these are imperfect.

      When you take into account the idea that there will be overrides for built in services, then you can't rely on their being just a single match. That's what the Alias service in tapestry-core is all about: contributing to the MasterObjectProvider to handle overrides. Unfortunately, contributions to Alias are clumsy, as they have to rely on @InjectService for disambiguation.

      Having to know the service id is a problem, since service ids are not refactoring safe: refactoring the service interface name will likely change the service id, but @InjectService annotation values will still point to the old name.

      Imagine instead a marker annotation; no attributes, attached to a type. Maybe it's attached to the service implementation class, maybe its specified to the ServiceBinder.

      When injecting, the parameter type and annotations are checked for any known marker annotation (all the marker annotation will be identified at Registry start up). The parameter type is matched against services with the marker, at must be unique for just those services.

      An idiom involving a nested annotation named "Local" is likely, thus:

      public class MyModule

      @interface Local { }

      public MyService buildMyService(@Local OtherService other)

      { ... }

      I'm fairly certain Guice has something quite similiar.

      The question is: can we get rid of service ids entirely?


        Howard M. Lewis Ship created issue -
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.0.6 [ 12312544 ]
        Mark Thomas made changes -
        Workflow jira [ 12414133 ] Default workflow, editable Closed status [ 12569319 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569319 ] jira [ 12590578 ]


          • Assignee:
            Howard M. Lewis Ship
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: