Q:

Where I should put glue?

I have application written with Java and Guice. For this application I have several views. Some of them use Guice, other - doesn't. Now I want to separate my code into independent modules. I can devide application logic, viewers interfaces and viewers implementations. In which module should I put Guice configuration per each view variant? I think there is two possible answers - into viewers module (in this case all viewers will depend from Guice) or contribute such ModuleConfiguration separately from module. What is the right way? If separably, what is the best way for such contribution?

A:

Just split the configuration into several Guice Modules near the code that they are wiring. Then use composition to construct an injector.
Injector injector = Guice.createInjector(new ModuleA(), new ModuleB());

