[
https://issues.apache.org/jira/browse/TAP5-443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664170#action_12664170
]
Fernando commented on TAP5-443:
-------------------------------
"BTW, when there are multiple markers at the point of injection, what's
injected is based on the intersection of type and all markers." - Howard
So this statement was eating at me.. You're right that TIoC is smart enough to
use a long list of markers to determine what to bind, but exception was not the
code that I patched. There was a service that was depending on the service
ComponentEventResultProcessor (CERP) but with only a @Traditional marker.. so
at that point, tapestry had no other way to differentiate between the two
service implementations. So one way to fix it would be to force everyone to
also add @Primary @Traditional every time they want to bring in a
ComponentEventResultProcessor (CERP)..
I can go on and on, but here is the summary of how someone trying to inject a
CERP service would see. CIRP == ComponentInstanceResultProcessor.
currently:
@Primary @Traditional CERP ==> umbrella CERP
@Traditional @ComponentInstanceProcessor CERP ==> CIRP
@Primary CERP ==> umbrella CERP
@Traditional CERP ==> EXCEPTION, can't differentiate between the two.
patch (submitted above):
@Traditional CERP ==> umbrella CERP
@ComponentInstanceProcessor ==> CIRP
@Primary CERP ==> umbrealla CERP
dream patch (mentioned below):
CERP ==> umbrella CERP
CIRP ==> CIRP
@Traditional CERP ==> umbrella CERP
@Primary CERP ==> umbrealla CERP
My dream patch refers to actually removing the @ComponentInstanceProcessor
marker all together, and adding CIRP to Tapestry IoC without markers, simply as
itself:
sudo patch:
- bind( ComponentEventResultProcessor.class,
ComponentInstanceResultProcessor.class ).withMarkers( Traditional.class,
ComponentInstanceProcessor.class )
+ bind( ComponentInstanceResultProcessor.class,
ComponentInstanceResultProcessor.class )
> There are two services that implement ComponentEventResultProcessor, and
> declare the @Traditional marker
> --------------------------------------------------------------------------------------------------------
>
> Key: TAP5-443
> URL: https://issues.apache.org/jira/browse/TAP5-443
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-core
> Affects Versions: 5.1.0.0
> Reporter: Fernando
> Assignee: Howard M. Lewis Ship
> Priority: Blocker
>
> This causes a bad exception when tapestry tries to resolve an IoC dependency
> asking for @Traditional ComponentEventResultProcessor...
> I think you just want to remove it from
> ComponentInstanceResultProcessor.java, and remove it from
> TapestryModule.java:1346 (where it uses the secondary marker,
> @ComponentInstanceProcessor ).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.