I have a guice module added to the injector using injector = Guice.createInjector(...
but its configure method is never called.
Is there something I m missing?.
injector = Guice.createInjector(....,new XModule(),....
import net.spy.memcached.MemcachedClient;
import com.google.inject.AbstractModule;
public class XModule extends AbstractModule {
@Override
protected voi开发者_StackOverflow中文版d configure() {
//Never called
}
}
Configure is only called when the injection is actually hit. i.e. when you try an inject an object of that type. Dumb question sorry.
Hard to say. Guice should call configure
on all modules it's given so I can only assume something else is going on that you aren't showing. Can you post a short, self-contained example that demonstrates this behavior?
精彩评论