users@hk2.java.net

AbstractBinder#addActiveDescriptor vs AbstractBinder#bind for Custom Injection Resolver

From: buko <buko_at_chiubarobot.com>
Date: Fri, 9 Aug 2013 00:42:26 -0400

Not sure if this is expected behavior or not but I've noticed that:

(1) addActiveDescriptor(UserForm.class);

In an AbstractBinder will *not* do annotation-based custom injection
resolution. The field is left null and the known injectees is empty.

But:

(2)
bind(TestForm.class).to(TestForm.class).in(PerLookup.class).qualifiedBy(new
Annotation() {

            @Override
            public Class<? extends Annotation> annotationType() {
                return Bindable.class;
            }
        });

Does do custom injection resolution.

Is this right? I'd prefer to use (1) for binding stuff since the qualified
syntax is quite annoying but does addActiveDescriptor somehow not
detect/check for all annotations on it, particularly those custom injection
resolvers might be interested in?