Pergunta

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.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top