anyone?

On Feb 10, 4:34 pm, egolan <[email protected]> wrote:
> Hi,
> I would like to consult whether the way I constructed my modules is
> the preferred way.
>
> I created a module for each part of the application (a Guice Abstract
> module for some logic module in the application).
> I have a main module that in its configure method, it uses
> install(...) method.
> The main class calls this module and the Guice.getInjector() and run
> what it need to run.
>
> One of the sub module is not created in the main module, but instead
> the main creates it and call the main module with it.
> I did it to allow me to do an end2end test with the main module, but
> with a different sub module.
>
> Main module:
> public MpsModule(Properties properties, MpsServiceModule
> moduleForMpsService) {
>         this.properties = properties;
>         this.moduleForMpsService = moduleForMpsService;
>     }
>
>     @Override
>     protected void configure() {
>         Names.bindProperties(binder(), properties);
>         convertToTypes(dateMatcher(), dateConverter());
>         install(new MpsBizModule());
>         install(new MpsLogicModule());
>         install(moduleForMpsService);
>         install(new
> ConfigurationModule(MpsConfigurationName.MpsLastProcessingTime.name()));
>     }
>
> Here's the sub module that I have different implementation for using
> different service:
> (MpsServiceModule just extends Module)
> public class MpsServiceModuleImpl extends AbstractModule implements
> MpsServiceModule {
>     public MpsServiceModuleImpl() {
>         System.out.println("----------------- MpsServiceModuleImpl
> -----------------");
>     }
>
>     @Override
>     protected void configure() {
>
> ThrowingProviderBinder.create(binder()).bind(MpsServiceProvider.class,
> IProductMatchService.class).to(
>                 MpsServiceProviderImpl.class);
>     }
>
> }
>
> Any comments?
>
> Thanks,
>
> Eyal

-- 
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