------ Home ------ Simple Configuration ------ 2012 ~~ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ Loading Modules <<>>s can be now load applying the SPI pattern in an easy way: define first which <<>>s you intend to load in the <<>> 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 <<>> 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!!! :) Loading modules from SystemProperties Alternatively, SPIs can be specified via : ---------------------------------------- java -Dcom.google.inject.Module=com.acme.FooModule,com.acme.BarModule,com.acme.FooTestCase$AcmeModule ---------------------------------------- Where <<,>> is the separator character between Providers. * Note If SPIs will be found in , <<>> file(s) will be ignored Apache Maven Users Just add the dependency below and let Maven do the rest: +--------------------------------------+ ${project.groupId} ${project.groupId}.modules ${project.version} compile +--------------------------------------+