users@hk2.java.net

Re: ContractsProvided and Qualifiers

From: John Wells <john.wells_at_oracle.com>
Date: Tue, 13 May 2014 10:54:17 -0400

Yes, AbstractBinder.addActiveDescriptor(Class<?>) should do the trick.

On 5/13/2014 8:38 AM, buko wrote:
> ServiceLocatorUtilities.addClasses ... takes a ServiceLocator.
>
> What if I want to bind the class in the AbstractBinder along with all
> my other bindings? What if I use AbstractBinder.addActiveDescriptor
> (which seems to be all ServiceLocator.addClasses is doing)?
>
>
>
> On Tue, May 13, 2014 at 8:00 AM, John Wells <john.wells_at_oracle.com
> <mailto:john.wells_at_oracle.com>> wrote:
>
> The bind family of calls do not honor any of the annotations on
> the class (including @Contract, @ContractsProvided or any
> annotation with @Qualifier). Instead you must always explicitly
> add all the contracts and qualifiers in your bind chain.
>
> If you want automatic analysis of your classes instead of using
> bind use ServiceLocatorUtilities.addClasses.
>
>
> On 5/13/2014 7:11 AM, buko wrote:
>
> Spoke to soon. Looks like another bug with ContractsProvided:
> if you have qualifier annotations on a service with
> ContractsProvided it seems those qualifier annotations are
> simply ignored and cannot be used to find the service later.
>
>
>