Guice is not injecting objects for WordDAOImpl. Im not sure if I'm
doing anything right.
In Spring I would usually create two named @Bean methods that expose
two different objects of the same class.
I'm not sure how it it properly done here
bind(JDBCQueryExecutor.class).to(JDBCQueryExecutorImpl.class);
Multibinder<WordProcessor> multibinder = Multibinder
.newSetBinder(binder(),
WordProcessor.class, Names
.named("wordProcessors"));
for (final String tableName : ...) {
multibinder.addBinding().toProvider(new
Provider<WordProcessor>()
{
public WordProcessor get() {
return new
DBCommonWordRemover(new WordDAOImpl(tableName));
};
});
public class WordDAOImpl implements WordDAO {
private String dbName;
public WordDAOImpl(String dbName) {
this.dbName = dbName;
}
@Inject
private JDBCQueryExecutor queryExecutor; <<<<- Nothing is injected
here
}
--
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.