Guice cannot do JIT bindings that include binding/qualifier annotations. Binding annotations are not valid on classes, and Guice does not look for them there.
sam On Mon, Aug 26, 2013 at 9:28 PM, John Nham <[email protected]> wrote: > I have the following scenario that I thought would fall under JIT > bindings<https://code.google.com/p/google-guice/wiki/JustInTimeBindings>, > but it's not working. Is it even possible, either with JIT bindings or > another Guice feature? > > interface MyInterface {} > > @Anno > class ImplA implements MyInterface > > class Runner { > ... set up Guice injector - NO explicit bindings > injector.getInstance(Key.get(MyInterface.class, Anno.class)); <-- error > } > > I've tried a lot of variations on the above but each time "No > implementation was bound". > > The motivation is that the Runner has no knowledge of all the > implementations - there could end up being many and we don't want to change > the Runner (or its Module) each time. > > For JIT bindings, the only thing working for me so far are straight-up > SameClass-to-SameClass mappings. > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
