One more explanation, wrote it before seeing it was already answered:) This users list has better response time than the fire department:)
The order of the modules doesn't matter. That means Guice.createInjector(new ModuleOne(), new ModuleTwo(), new LocalModule ()); is equivalent to Guice.createInjector(new LocalModule(), new ModuleOne(), new ModuleTwo ()); now notice in the second case that String has been exposed meaning once a binding is created it is immutable and global for all i.e. nobody is allowed to redefine it. This property of bindings makes it possible for the module order to be in any way. If bindings could overwrite each other then the order of modules would matter and that is not very good idea. LocalModule addes String to "global" bindings ModuleOne addes String to "private" bindings but it CANNOT work because it would redefine the "global" binding. If you don't expose String in LocalModule it would work fine. Cheers, Alen On 28 feb., 14:26, bank kus <[email protected]> wrote: > Using snapshot20090205 this code doesnt work. If I removed the > LocalModule from the injector's constructor it works fine. Is this > expected? Whats the right way to do this. > > Code =>http://eugeneciurana.com/pastebin/pastebin.php?show=40695 > > Error: > A binding to java.lang.String was already configured at > LocalModule.configure (TestPrivateModules.java:45) > > banks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
