Hi,

My use-case is that I have three modules, and I register them using

injector = Guice.createInjector(Stage.PRODUCTION, moduleFoo);

And later on I need to register another module.

What would be the correct way to do this ?

Thanks & Regards
/Nuwan


On Sat, Aug 21, 2010 at 3:46 AM, Fred Faber <[email protected]> wrote:

> Hello,
>
> If a binding in a parent module exists, you can not include this same
> binding in a child module.  The idea is that you could can add new bindings
> in a child module that do not exist in a parent module.  With several
> sibling child modules, you can then have different values for this same
> binding.
>
> Perhaps what you're seeking is Modules.override(), which will let you
> override a binding in one module with a module in another module.
>
> regards
> -Fred
>
>  On Fri, Aug 20, 2010 at 12:15 PM, nuwanbando <[email protected]>wrote:
>
>>  Hi,
>>
>> I have created an injector using
>>
>> injector = Guice.createInjector(Stage.PRODUCTION, moduleFoo);
>>
>> afterwards I am registering another module for a child injector using,
>>
>> injector = injector.createChildInjector(moduleBar);
>>
>> but I am getting the following exception,
>>
>> com.google.inject.ConfigurationException: Guice configuration errors:
>>
>> 1) A binding to -------Class-------- already exists on a child
>> injector.
>>  while locating-------Class--------
>>    for parameter 0 at -------Class--------.<init>(-------
>> Class--------:41)
>>  while locating -------Class--------
>>
>> Any help is greatly appreciated.
>>
>> Regards
>> /Nuwan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-guice%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>



-- 
Nuwan Bandara
- www.nuwanbando.com - Stranger Than Fiction

[ http://www.linkedin.com/in/nuwanbandara ]
[ http://www.twitter.com/nuwanbando ]

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to