Guice, main and startup configuration flags- July 10, 2008 Here is a small trick we use in an in-house program wired with Google Guice. The goal is to pick the wiring configuration from the command-line without too many contortions. The idea is to use enums to represent the wiring, and using the command-line to pick the enum. Thus: enum WhichOne Uses module "A", defined elsewhere. ONE(new ModuleA()), Uses module "A" and "B", defined elsewhere. TWO(new ModuleA(), new ModuleB()); private final Module module; WhichOne(final...http://binkley.blogspot.com/2008/07/guice-main-and-startup-configuration.html |