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

ObjectLocator will return wrong service implementation delegate when using markers alone

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.3
    • Fix Version/s: 5.4
    • Component/s: tapestry-ioc
    • Labels:
      None

      Description

      Having the following services bound using the specified markers

      binder.bind(IServiceOne.class, ServiceOneImpl.class).withMarker(ServiceOneMarker.class);
      binder.bind(IServiceOne.class, ServiceOneSecondImpl.class).withMarker(ServiceOneSecondMarker.class);

      will cause the ObjectLocator service to return the wrong implementation class when doing this

      objectLocator.getService(IServiceOne.class, ServiceOneSecondMarker.class);

      This will return an instance of ServiceOneImpl instead of ServiceOneSecondImpl, although the marker ServiceOneSecondMarker was never registered with the ServiceOneImpl class.

      As a workaround, one must use withId(...) when binding the service interface implementation classes. In that case, the object locator will return the correct implementation class.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              carsten.klein Carsten Klein
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: