But you can label the point of injection with @Primary, that's the
whole point of using marker annotations for disambiguation.

On Thu, Mar 22, 2012 at 10:55 AM, Denis Stepanov
<[email protected]> wrote:
> You didn't understand me, I have only one implementation with the @Primary, 
> the problem is when you are accesing the service without it.
>
> Example:
>
> MyService.class, new Clustered();
> MyService.class, new Local(); @Primary
>
>
> @Inject
> MyService service <-- this will fail because there are two implementations, 
> adding @Primary will help
>
> My suggestion is to change the default behaviour to select a service with the 
> @Primary when there are more than one implementations of the same interface.
>
> Denis
>
>
> Mar 22, 2012 v 6:17 PM, Igor Drobiazko:
>
>> The @Primary annotation is supposed to be placed on a single
>> implementation, not all of them. The most frequent use case is a service
>> which is implemented as a chain or a strategy.
>>
>> On Thu, Mar 22, 2012 at 1:55 PM, Denis Stepanov 
>> <[email protected]>wrote:
>>
>>> Would be possible to change the default behaviour to select a service
>>> marked @Primary when there are multiple occurrences of the same interface?
>>> I'm finding that it's complicated to add a service with the same interface,
>>> I need to find all occurrences of the interface and mark them @Primary and
>>> it isn't possible when there is a third-party library relying on it.
>>
>> I would like have the same interface for the @Local and the @Clustered
>>> service and I would like to keep the local to be the primary without
>>> changing the interface or marking access points.
>>>
>>> Denis
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>> --
>> Best regards,
>>
>> Igor Drobiazko
>> http://tapestry5.de
>> http://twitter.com/drobiazko
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to