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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know if this is what you’re after, but you can annotate the
Testclass with@ImplementedBy(TestImpl.class)to save you thebind(Test.class).to(TestImpl.class)in yourGinModule.See http://code.google.com/p/google-guice/wiki/JustInTimeBindings