문제

Can I add binds to a GIN module dynamically?

For example, having a module "ExampleModule," and calling a static method on it, eg:

bind (Test.class, TestImpl.class);

and GIN do the bind automatically?

Or maybe using annotations?

Thanks in advance.

도움이 되었습니까?

해결책

I don't know if this is what you're after, but you can annotate the Test class with @ImplementedBy(TestImpl.class) to save you the bind(Test.class).to(TestImpl.class) in your GinModule.
See http://code.google.com/p/google-guice/wiki/JustInTimeBindings

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top