com.google.inject.Modules can be now load applying the SPI pattern in an easy way: define first which Modules you intend to load in the META-INF/services/com.google.inject.Module file(s):
# created by Jack Bauer in less than 24h com.acme.FooModule com.acme.BarModule com.acme.FooTestCase$AcmeModule # EOL comment # comments and blank lines supported #
then, load modules invoking org.apache.onami.spi.GuiceServiceLoader.* APIs:
import static org.apache.onami.spi.GuiceServiceLoader.loadModules; import static com.google.inject.Guice.createInjector; import com.google.inject.Injector; ... Injector injector = createInjector( loadModules() );
Eh?!? Just that?!? YES!!! :)