pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Child injector binding override #770

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I have authored two little Arquillian extensions that are based on Google 
Guice: 
http://planet.jboss.org/post/arquillian_google_guice_extension_1_0_0_alpha2_rele
ased.
Lately we had discussion, that it would be a nice feature to have possibility 
to override the bindings with in those Arquilian tests: 
(https://github.com/Netflix/karyon/pull/46#issuecomment-22710564). Although in 
at least of the extensions, I do not have any control of the Guice Injector 
lifecycle. It’s being created outside of the Arquillian lifecycle scope and I 
am not be able to use the Modules.override functionality. The only way to 
modify the bindings, would be to allow to override them at runtime, by creating 
a new child injector with the desired bindings. So this is what I would like to 
propose and contribute a simple implementation.
I wasn’t able to find any guidelines into the code contribution to Google 
Guice, so I simply attached the patch with the code changes. I’m also aware 
that this functionality may need some more excensive testing. 

I am looking forward for your replay,
Regards,
Jakub Narloch

Original issue reported on code.google.com by jmnarl...@gmail.com on 8 Sep 2013 at 10:07

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch, Jakub.  We're going not going to offer the ability to 
override bindings at runtime for now other than using Modules.override.  If 
you'd like to talk more about this, please bring the issue up on the user 
mailing list!

Original comment by sberlin on 5 Dec 2013 at 10:49