With Java 6 you could use the unguicy ServiceLoader (http://
java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html) to
configure different Modules on startup time. Just provide a text file
at "META-INF/services/com.google.inject.Module" with the enabled
modules each per line and you can instantiate a Injector like

Guice.createInjector(ServiceLoader.load(Module.class))



On May 23, 3:09 am, "[email protected]"
<[email protected]> wrote:
> Howdy list,
>
> I'm starting my app something like this:
>
> Injector launchInjector = Guice.createInjector(new SettingsModule());
> DisplaySettings displaySettings = launchInjector.getInstance
> (DisplaySettings.class);
> Injector injector = launchInjector.createChildInjector(RenderModule.get
> (displaySettings.getRenderer()));
>
> That feels a bit ugly. Is there a prettier way where I can just
> conditionally inside a provider (or similar) based on my settings
> class chose what modules to create my injectors with?
>
> Thanks for any help!
--~--~---------~--~----~------------~-------~--~----~
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