[ 
https://issues.apache.org/jira/browse/TAP5-1954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14375302#comment-14375302
 ] 

Felix Scheffer commented on TAP5-1954:
--------------------------------------

I can't reproduce the issue in 5.4. The code throws an exception because both 
services have the same id.

{code}
java.lang.RuntimeException: Service TestService2 (defined by Reloadable 
com.fscheffer.testproject.services.TestServiceBImpl via 
com.fscheffer.testproject.services.AppModule.bind(ServiceBinder) (at 
AppModule.java:22)) conflicts with previously defined service defined by 
Reloadable com.fscheffer.testproject.services.TestServiceAImpl via 
com.fscheffer.testproject.services.AppModule.bind(ServiceBinder) (at 
AppModule.java:22).
        at 
org.apache.tapestry5.ioc.internal.DefaultModuleDefImpl.addServiceDef(DefaultModuleDefImpl.java:543)
        at 
org.apache.tapestry5.ioc.internal.ServiceBinderImpl.flush(ServiceBinderImpl.java:105)
        at 
org.apache.tapestry5.ioc.internal.ServiceBinderImpl.finish(ServiceBinderImpl.java:84)
        at 
org.apache.tapestry5.ioc.internal.DefaultModuleDefImpl.bind(DefaultModuleDefImpl.java:601)
        at 
org.apache.tapestry5.ioc.internal.DefaultModuleDefImpl.<init>(DefaultModuleDefImpl.java:148)
        at 
org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:123)
        at 
org.apache.tapestry5.internal.TapestryAppInitializer.<init>(TapestryAppInitializer.java:117)
        at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:97)
{code}

I added withSimpleId() to both bindings and it works fine!

Not sure about 5.3.8


> ObjectLocator will return wrong service implementation delegate when using 
> markers alone
> ----------------------------------------------------------------------------------------
>
>                 Key: TAP5-1954
>                 URL: https://issues.apache.org/jira/browse/TAP5-1954
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-ioc
>    Affects Versions: 5.3.3
>            Reporter: Carsten Klein
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to