开发者

Why is configure not called on my Guice module?

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜