Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
5.3.3
-
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.