Hi All, I have the exact same problem as Tim in message
http://groups.google.com/group/google-guice/browse_thread/thread/ee242a28b033ce72
I tried using a provider method but it doesn't work either. I'm doing
something like this:
@Provides
public QueryExecutor createQueryExecutor() {
Key<QueryExecutor> executorKey = Key.get(QueryExecutor.class,
Names.named(Configuration.getProperty("executor.queryExecutor")));
Provider<QueryExecutor> provider = getProvider(executorKey);
return provider.get();
}
On the same module, on the "configuration" method I bind the interface
"QueryExecutor" to diferent implementations depending on the "Named"
annotation.
bind(QueryExecutor.class).annotatedWith(Names.named("one")).to(QueryExecutorImpl1.class);
bind(QueryExecutor.class).annotatedWith(Names.named("two")).to(QueryExecutorImpl2.class);
¿Can I use the provider from the provider method? It seems that the
binder is null when the createQueryExecutor() method is called and
that's causing a null pointer exception.
Thanks
Tomás
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.