PageRenderTime 3628ms queryTime 473ms sortTime 0ms getByIdsTime 109ms findMatchingLines 135ms

100+ results results for 'google guice createinjector lang:java' (3628 ms)

Not the results you expected?
MethodInterceptionTest.java https://gitlab.com/metamorphiccode/guice | Java | 369 lines
                    
67  public void testSharedProxyClasses() {
                    
68    Injector injector = Guice.createInjector(new AbstractModule() {
                    
69      protected void configure() {
                    
256  public void testInterceptingNonBridgeWorks() {
                    
257    Injector injector = Guice.createInjector(new AbstractModule() {
                    
258      @Override
                    
286    final List<String> callList = Lists.newArrayList();
                    
287    Injector injector = Guice.createInjector(new AbstractModule() {
                    
288      protected void configure() {
                    
317  public void testDeDuplicateInterceptors() throws Exception {
                    
318    Injector injector = Guice.createInjector(new AbstractModule() {
                    
319      @Override protected void configure() {
                    
332    final Queue<Runnable> queue = Lists.newLinkedList();
                    
333    Injector injector = Guice.createInjector(new AbstractModule() {
                    
334      protected void configure() {
                    
                
CommaFeedApplication.java https://gitlab.com/gmi7/commafeed | Java | 174 lines
                    
48import com.commafeed.frontend.session.SessionHelperFactoryProvider;
                    
49import com.google.inject.Guice;
                    
50import com.google.inject.Injector;
                    
50import com.google.inject.Injector;
                    
51import com.google.inject.Key;
                    
52import com.google.inject.TypeLiteral;
                    
110		// guice init
                    
111		Injector injector = Guice.createInjector(new CommaFeedModule(hibernateBundle.getSessionFactory(), config, environment.metrics()));
                    
112
                    
                
SiteProgram.java https://gitlab.com/chenfengxu/gerrit | Java | 266 lines
                    
41import com.google.inject.CreationException;
                    
42import com.google.inject.Guice;
                    
43import com.google.inject.Injector;
                    
157    modules.add(configModule);
                    
158    Injector cfgInjector = Guice.createInjector(sitePathModule, configModule);
                    
159    Config cfg = cfgInjector.getInstance(Key.get(Config.class, GerritServerConfig.class));
                    
171    DataSourceType dst =
                    
172        Guice.createInjector(new DataSourceModule(), configModule, sitePathModule)
                    
173            .getInstance(Key.get(DataSourceType.class, Names.named(dbType.toLowerCase())));
                    
187    try {
                    
188      return Guice.createInjector(PRODUCTION, modules);
                    
189    } catch (CreationException ce) {
                    
243    modules.add(new DataSourceModule());
                    
244    Injector i = Guice.createInjector(modules);
                    
245    List<Binding<DataSourceType>> dsTypeBindings =
                    
                
ParentInjectorTest.java https://gitlab.com/metamorphiccode/guice | Java | 331 lines
                    
69  public void testChildCannotBindToAParentJitBinding() {
                    
70    Injector parent = Guice.createInjector();
                    
71    parent.getInstance(A.class);
                    
81  public void testJustInTimeBindingsAreSharedWithParentIfPossible() {
                    
82    Injector parent = Guice.createInjector();
                    
83    Injector child = parent.createChildInjector();
                    
140  public void testInterceptorsInherited() {
                    
141    Injector parent = Guice.createInjector(new AbstractModule() {
                    
142      @Override protected void configure() {
                    
158  public void testTypeConvertersInherited() {
                    
159    Injector parent = Guice.createInjector(bindListConverterModule);
                    
160    Injector child = parent.createChildInjector(bindStringNamedB);
                    
240  public void testErrorInParentButOkayInChild() {
                    
241    Injector parent = Guice.createInjector();
                    
242    Injector childInjector = parent.createChildInjector(new AbstractModule() {
                    
                
TestLifeCycleManager.java https://gitlab.com/CORP-RESELLER/airlift | Java | 328 lines
                    
20import com.google.inject.CreationException;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Injector;
                    
124        };
                    
125        Injector injector = Guice.createInjector(
                    
126                Stage.PRODUCTION,
                    
249    {
                    
250        Injector injector = Guice.createInjector(
                    
251                Stage.PRODUCTION,
                    
275    {
                    
276        Injector injector = Guice.createInjector(
                    
277                Stage.PRODUCTION,
                    
314        };
                    
315        Injector injector = Guice.createInjector(
                    
316                Stage.PRODUCTION,
                    
                
ProvidesIntoTest.java https://gitlab.com/metamorphiccode/guice | Java | 373 lines
                    
49  public void testAnnotation() throws Exception {
                    
50    Injector injector = Guice.createInjector(MultibindingsScanner.asModule(), new AbstractModule() {
                    
51      @Override protected void configure() {}
                    
297    try {
                    
298      Guice.createInjector(MultibindingsScanner.asModule(), m);
                    
299      fail();
                    
312    try {
                    
313      Guice.createInjector(MultibindingsScanner.asModule(), m);
                    
314      fail();
                    
339    try {
                    
340      Guice.createInjector(MultibindingsScanner.asModule(), m);
                    
341      fail();
                    
364    try {
                    
365      Guice.createInjector(MultibindingsScanner.asModule(), m);
                    
366      fail();
                    
                
TransferRequestIntegrationTest.java https://gitlab.com/metamorphiccode/guice | Java | 215 lines
                    
1/**
                    
2 * Copyright (C) 2012 Google Inc.
                    
3 *
                    
16
                    
17package com.google.inject.servlet;
                    
18
                    
20import com.google.inject.AbstractModule;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Injector;
                    
69  public void testTransferNonHttpRequest() throws Exception {
                    
70    final Injector injector = Guice.createInjector(new AbstractModule() {
                    
71      @Override protected void configure() {
                    
99  public void testTransferNonHttpRequest_closeable() throws Exception {
                    
100    final Injector injector = Guice.createInjector(new AbstractModule() {
                    
101      @Override protected void configure() {
                    
                
PackageFilterTests.java https://github.com/manzke/guice-automatic-injection.git | Java | 145 lines
                    
25import com.google.inject.ConfigurationException;
                    
26import com.google.inject.Guice;
                    
27import com.google.inject.Injector;
                    
40	public void createDynamicModule() {
                    
41		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
42			PackageFilter.create(PackageFilterTests.class)));
                    
63	public void createTestInterface() {
                    
64		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
65			PackageFilter.create(PackageFilterTests.class)));
                    
76	public void createSecondTestInterface() {
                    
77		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
78			PackageFilter.create(PackageFilterTests.class)));
                    
89	public void createAllInterfaces() {
                    
90		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
91			PackageFilter.create(PackageFilterTests.class)));
                    
                
AutobindTests.java https://github.com/manzke/guice-automatic-injection.git | Java | 145 lines
                    
25import com.google.inject.ConfigurationException;
                    
26import com.google.inject.Guice;
                    
27import com.google.inject.Injector;
                    
40	public void createDynamicModule() {
                    
41		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
42			PackageFilter.create(AutobindTests.class, false)));
                    
63	public void createTestInterface() {
                    
64		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
65			PackageFilter.create(AutobindTests.class, false)));
                    
76	public void createSecondTestInterface() {
                    
77		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
78			PackageFilter.create(AutobindTests.class, false)));
                    
89	public void createAllInterfaces() {
                    
90		Injector injector = Guice.createInjector(new TestStartupModule(SonatypeScanner.class,
                    
91			PackageFilter.create(AutobindTests.class, false)));
                    
                
VarargsFilterDispatchIntegrationTest.java https://gitlab.com/metamorphiccode/guice | Java | 182 lines
                    
1package com.google.inject.servlet;
                    
2
                    
7
                    
8import com.google.inject.Guice;
                    
9import com.google.inject.Injector;
                    
9import com.google.inject.Injector;
                    
10import com.google.inject.Key;
                    
11import com.google.inject.Singleton;
                    
47  public final void testDispatchRequestToManagedPipeline() throws ServletException, IOException {
                    
48    final Injector injector = Guice.createInjector(new ServletModule() {
                    
49
                    
87  public final void testDispatchThatNoFiltersFire() throws ServletException, IOException {
                    
88    final Injector injector = Guice.createInjector(new ServletModule() {
                    
89
                    
128
                    
129    final Injector injector = Guice.createInjector(new ServletModule() {
                    
130
                    
                
GuiceCamelContext.java https://gitlab.com/matticala/apache-camel | Java | 176 lines
                    
16 */
                    
17package org.apache.camel.guice;
                    
18
                    
26
                    
27import com.google.inject.Binding;
                    
28import com.google.inject.Inject;
                    
32import org.apache.camel.TypeConverter;
                    
33import org.apache.camel.guice.impl.GuiceInjector;
                    
34import org.apache.camel.guice.inject.Injectors;
                    
48 * It is recommended you use this implementation with the
                    
49 * <a href="http://code.google.com/p/guiceyfruit/wiki/GuiceyJndi">Guicey JNDI Provider</a>
                    
50 *
                    
56    @Inject
                    
57    public GuiceCamelContext(com.google.inject.Injector injector) {
                    
58        this.injector = injector;
                    
                
LocalToJpaDataMigratorTest.java https://gitlab.com/unofficial-mirrors/eclipse-che | Java | 300 lines
                    
12
                    
13import com.google.common.collect.ImmutableMap;
                    
14import com.google.gson.Gson;
                    
15import com.google.gson.JsonElement;
                    
16import com.google.gson.JsonObject;
                    
17import com.google.gson.JsonPrimitive;
                    
18import com.google.gson.JsonSerializationContext;
                    
19import com.google.gson.JsonSerializer;
                    
20import com.google.inject.AbstractModule;
                    
20import com.google.inject.AbstractModule;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Injector;
                    
104        factory = new LocalStorageFactory(workingDir.toString());
                    
105        injector = Guice.createInjector(Stage.PRODUCTION, new AbstractModule() {
                    
106            @Override
                    
                
LimeTestUtils.java https://github.com/WIZARDISHUNGRY/limewire.git | Java | 318 lines
                    
29import com.google.inject.AbstractModule;
                    
30import com.google.inject.Guice;
                    
31import com.google.inject.Injector;
                    
171    
                    
172    public static Injector createInjector(Stage stage, Class<? extends ActivityCallback> callbackClass, Module...modules) {
                    
173        Module combinedReplacements = Modules.combine(modules);
                    
175        Module replaced = Modules.override(combinedOriginals).with(combinedReplacements);
                    
176        return Guice.createInjector(stage, replaced);
                    
177    }
                    
179    /**
                    
180     * Wraps {@link #createInjector(Module, Class) createInjector(Module, ActivityCallbackStub.class)}.
                    
181     */
                    
208    /**
                    
209     * Wraps {@link #createInjectorAndStart(Module, Class) createInjectorAndStart(Module, ActivityCallbackStub.class)}.
                    
210     */
                    
                
AbstractLdapSynchronizer.java https://gitlab.com/gesnaud/xivo-lib-ldap | Java | 252 lines
                    
29
                    
30import com.google.inject.Guice;
                    
31import com.google.inject.Inject;
                    
31import com.google.inject.Inject;
                    
32import com.google.inject.Injector;
                    
33
                    
60        AbstractLDAPModule module = getModuleInstance(moduleClass, parsing);
                    
61        Injector injector = Guice.createInjector(module);
                    
62        AbstractLdapSynchronizer synchronizer = injector.getInstance(AbstractLdapSynchronizer.class);
                    
                
ModuleAnnotatedMethodScannerTest.java https://gitlab.com/metamorphiccode/guice | Java | 394 lines
                    
62    };
                    
63    Injector injector = Guice.createInjector(module, NamedMunger.module());
                    
64
                    
317  public void testPrivateModuleInheritScanner_skipSourcesFromPrivateBinder2() {
                    
318    Injector injector = Guice.createInjector(NamedMunger.module(), new AbstractModule() {
                    
319      @Override protected void configure() {
                    
332  public void testPrivateModuleScannersDontImpactSiblings_usingPrivateModule() {
                    
333    Injector injector = Guice.createInjector(new PrivateModule() {
                    
334      @Override protected void configure() {
                    
352  public void testPrivateModuleScannersDontImpactSiblings_usingPrivateBinder() {
                    
353    Injector injector = Guice.createInjector(new AbstractModule() {
                    
354      @Override protected void configure() {
                    
379  public void testPrivateModuleWithinPrivateModule() {
                    
380    Injector injector = Guice.createInjector(NamedMunger.module(), new PrivateModule() {
                    
381      @Override protected void configure() {
                    
                
InjectorTest.java https://gitlab.com/metamorphiccode/guice | Java | 413 lines
                    
113      throws CreationException {
                    
114    Injector injector = Guice.createInjector(new AbstractModule() {
                    
115      protected void configure() {
                    
124  public void testInjectorApiIsNotSerializable() throws IOException {
                    
125    Injector injector = Guice.createInjector();
                    
126    assertNotSerializable(injector);
                    
205  public void testInjectStatics() throws CreationException {
                    
206    Guice.createInjector(new AbstractModule() {
                    
207      protected void configure() {
                    
342    try {
                    
343      Guice.createInjector().getInstance(SeaHorse.class);
                    
344      fail();
                    
353    try {
                    
354      Guice.createInjector().getInstance(Chicken.class);
                    
355      fail();
                    
                
ConfigurationFactoryTest.java https://gitlab.com/CORP-RESELLER/airlift | Java | 464 lines
                    
20import com.google.inject.CreationException;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Injector;
                    
22import com.google.inject.Injector;
                    
23import com.google.inject.Module;
                    
24import com.google.inject.spi.Message;
                    
113        TestMonitor monitor = new TestMonitor();
                    
114        Injector injector = createInjector(properties, monitor, new Module()
                    
115        {
                    
137        TestMonitor monitor = new TestMonitor();
                    
138        Injector injector = createInjector(properties, monitor, new Module()
                    
139        {
                    
297        List<Message> messages = new ConfigurationValidator(configurationFactory, null).validate(module);
                    
298        return Guice.createInjector(new ConfigurationModule(configurationFactory), module, new ValidationErrorModule(messages));
                    
299    }
                    
                
Main.java https://github.com/WIZARDISHUNGRY/limewire.git | Java | 292 lines
                    
15
                    
16import com.google.inject.Guice;
                    
17import com.google.inject.Injector;
                    
17import com.google.inject.Injector;
                    
18import com.google.inject.Singleton;
                    
19import com.google.inject.Stage;
                    
31    public static void main(String args[]) {
                    
32        Injector injector = Guice.createInjector(Stage.PRODUCTION, new LimeWireCoreModule(MainCallback.class));
                    
33        LimeWireCore core = injector.getInstance(LimeWireCore.class);
                    
                
ServerPlugin.java https://gitlab.com/chenfengxu/gerrit | Java | 313 lines
                    
19import com.google.gerrit.common.Nullable;
                    
20import com.google.gerrit.extensions.registration.RegistrationHandle;
                    
21import com.google.gerrit.extensions.registration.ReloadableRegistrationHandle;
                    
21import com.google.gerrit.extensions.registration.ReloadableRegistrationHandle;
                    
22import com.google.gerrit.lifecycle.LifecycleManager;
                    
23import com.google.gerrit.server.PluginUser;
                    
24import com.google.gerrit.server.util.RequestContext;
                    
25import com.google.inject.Guice;
                    
26import com.google.inject.Injector;
                    
26import com.google.inject.Injector;
                    
27import com.google.inject.Module;
                    
28import java.io.IOException;
                    
259    modules.add(new ServerPluginInfoModule(this, env.getServerMetrics()));
                    
260    return Guice.createInjector(modules);
                    
261  }
                    
                
OSGiTestActivator.java https://gitlab.com/metamorphiccode/guice | Java | 511 lines
                    
1/**
                    
2 * Copyright (C) 2009 Google Inc.
                    
3 *
                    
16
                    
17package com.googlecode.guice.bundle;
                    
18
                    
21import com.google.inject.AbstractModule;
                    
22import com.google.inject.Guice;
                    
23import com.google.inject.Inject;
                    
486
                    
487    Injector injector = Guice.createInjector(new TestModule(bundle));
                    
488/*if[AOP]*/
                    
488/*if[AOP]*/
                    
489    Injector aopInjector = Guice.createInjector(new TestModule(bundle), new InterceptorModule());
                    
490/*end[AOP]*/
                    
                
TestThriftClientAndServerModules.java https://gitlab.com/mayakarya/swift | Java | 312 lines
                    
39import com.google.inject.BindingAnnotation;
                    
40import com.google.inject.Guice;
                    
41import com.google.inject.Injector;
                    
91        final List<Object> eventHandlerContexts = newArrayList();
                    
92        Injector injector = Guice.createInjector(Stage.PRODUCTION,
                    
93                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
158    {
                    
159        Injector injector = Guice.createInjector(Stage.PRODUCTION,
                    
160                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
205    {
                    
206        Injector injector = Guice.createInjector(Stage.PRODUCTION,
                    
207                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
271
                    
272        Injector injector = Guice.createInjector(
                    
273                Stage.PRODUCTION,
                    
                
PluginGuiceEnvironment.java https://gitlab.com/chenfengxu/gerrit | Java | 648 lines
                    
19import static com.google.gerrit.extensions.registration.PrivateInternals_DynamicTypes.dynamicMapsOf;
                    
20import static com.google.gerrit.extensions.registration.PrivateInternals_DynamicTypes.dynamicSetsOf;
                    
21
                    
36import com.google.gerrit.extensions.webui.WebUiPlugin;
                    
37import com.google.gerrit.index.IndexCollection;
                    
38import com.google.gerrit.metrics.MetricMaker;
                    
43import com.google.inject.Binding;
                    
44import com.google.inject.Guice;
                    
45import com.google.inject.Inject;
                    
67/**
                    
68 * Tracks Guice bindings that should be exposed to loaded plugins.
                    
69 *
                    
115    this.copyConfigModule = ccm;
                    
116    this.copyConfigKeys = Guice.createInjector(ccm).getAllBindings().keySet();
                    
117    this.serverMetrics = serverMetrics;
                    
                
BaseInit.java https://gitlab.com/chenfengxu/gerrit | Java | 525 lines
                    
19import static com.google.inject.Scopes.SINGLETON;
                    
20import static com.google.inject.Stage.PRODUCTION;
                    
21
                    
40import com.google.gerrit.server.config.SitePaths;
                    
41import com.google.gerrit.server.git.GitRepositoryManager;
                    
42import com.google.gerrit.server.index.IndexModule;
                    
56import com.google.inject.CreationException;
                    
57import com.google.inject.Guice;
                    
58import com.google.inject.Inject;
                    
59import com.google.inject.Injector;
                    
60import com.google.inject.Module;
                    
61import com.google.inject.Provider;
                    
299    try {
                    
300      return Guice.createInjector(PRODUCTION, m).getInstance(SiteInit.class);
                    
301    } catch (CreationException ce) {
                    
                
TestHttpServerModule.java https://gitlab.com/github-cloud-corp/airlift | Java | 379 lines
                    
27import com.google.inject.Binder;
                    
28import com.google.inject.Guice;
                    
29import com.google.inject.Injector;
                    
121        ConfigurationFactory configFactory = new ConfigurationFactory(properties);
                    
122        Injector injector = Guice.createInjector(new HttpServerModule(),
                    
123                new NodeModule(),
                    
149        ConfigurationFactory configFactory = new ConfigurationFactory(properties);
                    
150        Injector injector = Guice.createInjector(new HttpServerModule(),
                    
151                new NodeModule(),
                    
190        ConfigurationFactory configFactory = new ConfigurationFactory(properties);
                    
191        Injector injector = Guice.createInjector(new HttpServerModule(),
                    
192                new NodeModule(),
                    
264        ConfigurationFactory configFactory = new ConfigurationFactory(properties);
                    
265        Injector injector = Guice.createInjector(new HttpServerModule(),
                    
266                new NodeModule(),
                    
                
JpaFlatFormDaoTest.java https://github.com/gatherdata/gather-data.git | Java | 171 lines
                    
44
                    
45import com.google.inject.Guice;
                    
46import com.google.inject.Inject;
                    
46import com.google.inject.Inject;
                    
47import com.google.inject.Injector;
                    
48
                    
63        // guice up the instance
                    
64        Injector injector = Guice.createInjector(new JpaTestingModule());
                    
65        injector.injectMembers(dao);
                    
                
Main.java https://github.com/zootella/Lost-in-the-Space.git | Java | 308 lines
                    
16
                    
17import com.google.inject.Guice;
                    
18import com.google.inject.Inject;
                    
18import com.google.inject.Inject;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.Singleton;
                    
20import com.google.inject.Singleton;
                    
21import com.google.inject.Stage;
                    
22import com.limegroup.gnutella.browser.MagnetOptions;
                    
40    public static void main(String args[]) {
                    
41        Injector injector = Guice.createInjector(Stage.PRODUCTION, new LimeWireCoreModule(MainCallback.class));
                    
42        Main main = injector.getInstance(Main.class);
                    
                
MembersInjectorTest.java https://gitlab.com/metamorphiccode/guice | Java | 401 lines
                    
178    try {
                    
179      Guice.createInjector(new AbstractModule() {
                    
180        protected void configure() {
                    
237  public void testGettingRawMembersInjector() {
                    
238    Injector injector = Guice.createInjector();
                    
239    try {
                    
248  public void testGettingAnnotatedMembersInjector() {
                    
249    Injector injector = Guice.createInjector();
                    
250    try {
                    
332    final ParallelMemberInjectionCallback2 c2 = new ParallelMemberInjectionCallback2();
                    
333    Guice.createInjector(new AbstractModule() {
                    
334      @Override
                    
358    final RecursiveMemberInjection rmi = new RecursiveMemberInjection();
                    
359    Guice.createInjector(new AbstractModule() {
                    
360      @Override
                    
                
RestfulJsonPeopleTest.java https://github.com/thesmith/bbc-shindig-example.git | Java | 262 lines
                    
40
                    
41import bbc.social.shindig.example.GuiceModule;
                    
42
                    
42
                    
43import com.google.common.collect.Lists;
                    
44import com.google.common.collect.Maps;
                    
44import com.google.common.collect.Maps;
                    
45import com.google.inject.Guice;
                    
46import com.google.inject.Injector;
                    
46import com.google.inject.Injector;
                    
47import com.google.inject.Key;
                    
48import com.google.inject.TypeLiteral;
                    
65  protected void setUp() throws Exception {
                    
66    Injector injector = Guice.createInjector(new PropertiesModule(),
                    
67        new GuiceModule());
                    
                
Init.java https://gitlab.com/chenfengxu/gerrit | Java | 257 lines
                    
19import com.google.gerrit.common.IoUtil;
                    
20import com.google.gerrit.common.PageLinks;
                    
21import com.google.gerrit.common.PluginData;
                    
21import com.google.gerrit.common.PluginData;
                    
22import com.google.gerrit.pgm.init.BaseInit;
                    
23import com.google.gerrit.pgm.init.Browser;
                    
25import com.google.gerrit.pgm.init.api.ConsoleUI;
                    
26import com.google.gerrit.pgm.util.ErrorLogFile;
                    
27import com.google.gerrit.server.config.GerritServerConfigModule;
                    
31import com.google.inject.AbstractModule;
                    
32import com.google.inject.Guice;
                    
33import com.google.inject.Inject;
                    
140    modules.add(new GerritServerConfigModule());
                    
141    Guice.createInjector(modules).injectMembers(this);
                    
142    start(run);
                    
                
Injectors.java https://gitlab.com/matticala/apache-camel | Java | 457 lines
                    
32import com.google.inject.Binding;
                    
33import com.google.inject.Guice;
                    
34import com.google.inject.Injector;
                    
34import com.google.inject.Injector;
                    
35import com.google.inject.Key;
                    
36import com.google.inject.Module;
                    
43import com.google.inject.matcher.Matcher;
                    
44import com.google.inject.name.Names;
                    
45import com.google.inject.util.Modules;
                    
46
                    
47import org.apache.camel.guice.jndi.GuiceInitialContextFactory;
                    
48import org.apache.camel.guice.jndi.internal.Classes;
                    
98        }
                    
99        Injector injector = Guice.createInjector(Modules.override(modules)
                    
100                .with(overridingModules));
                    
                
ProjectTypeTest.java https://gitlab.com/gaal/che-core | Java | 371 lines
                    
13import com.google.inject.AbstractModule;
                    
14import com.google.inject.Guice;
                    
15import com.google.inject.Injector;
                    
15import com.google.inject.Injector;
                    
16import com.google.inject.multibindings.Multibinder;
                    
17import org.eclipse.che.api.core.NotFoundException;
                    
42        // Bind components
                    
43        injector = Guice.createInjector(new AbstractModule() {
                    
44            @Override
                    
                
BTSwarmCoordinatorTest.java https://github.com/r3n/limewire5-ruby.git | Java | 352 lines
                    
26
                    
27import com.google.inject.Guice;
                    
28import com.google.inject.Injector;
                    
77    protected void setUp() throws Exception {
                    
78        injector = Guice.createInjector(new LimeWireCoreModule(ActivityCallbackStub.class));
                    
79        metaInfoFactory = injector.getInstance(BTMetaInfoFactory.class);
                    
                
package-info.java https://github.com/imyousuf/jersey.git | Java | 188 lines
                    
44 * Guice support is enabled by referencing the Guice filter
                    
45 * {@link com.google.inject.servlet.GuiceFilter} and an application
                    
46 * specific {@link javax.servlet.ServletContextListener} that extends from
                    
46 * specific {@link javax.servlet.ServletContextListener} that extends from
                    
47 * {@link com.google.inject.servlet.GuiceServletContextListener} in the web.xml.
                    
48 * For example, the web.xml may be as follows:
                    
100 * <code>GuiceResource</code> will be managed according to the scope declared
                    
101 * using Guice defined scopes. For example the <code>GuiceResource</code>
                    
102 * could be as follows:
                    
144 * 
                    
145 *     public class GuiceServletConfig extends GuiceServletContextListener {
                    
146 * 
                    
148 *         protected Injector getInjector() {
                    
149 *             return Guice.createInjector(new JerseyServletModule() {
                    
150 * 
                    
                
EmbulkService.java https://gitlab.com/CORP-RESELLER/embulk | Java | 76 lines
                    
4import com.google.common.collect.ImmutableList;
                    
5import com.google.inject.Guice;
                    
6import com.google.inject.Injector;
                    
6import com.google.inject.Injector;
                    
7import com.google.inject.Module;
                    
8import org.embulk.config.ConfigSource;
                    
14import org.embulk.jruby.JRubyScriptingModule;
                    
15import static com.google.common.base.Preconditions.checkState;
                    
16
                    
61
                    
62        injector = Guice.createInjector(modules);
                    
63        initialized = true;
                    
                
ThrowingProviderTest.java https://gitlab.com/metamorphiccode/guice | Java | 878 lines
                    
66  private final TestScope testScope = new TestScope();
                    
67  private Injector bindInjector = Guice.createInjector(new AbstractModule() {
                    
68    protected void configure() {
                    
368    try {
                    
369      Guice.createInjector(new AbstractModule() {
                    
370        protected void configure() {
                    
390    try {
                    
391      bindInjector = Guice.createInjector(new AbstractModule() {
                    
392        protected void configure() {
                    
406    try {
                    
407      Guice.createInjector(new AbstractModule() {
                    
408        protected void configure() {
                    
426  public void testDependencies_Bind() {
                    
427    bindInjector = Guice.createInjector(new AbstractModule() {
                    
428      protected void configure() {
                    
                
CheckedProviderTest.java https://gitlab.com/metamorphiccode/guice | Java | 1486 lines
                    
30import com.google.inject.CreationException;
                    
31import com.google.inject.Guice;
                    
32import com.google.inject.Inject;
                    
320    final MockRemoteProvider<Foo> mockRemoteProviderB = new MockRemoteProvider<Foo>();
                    
321    providesInjector = Guice.createInjector(new AbstractModule() {
                    
322      @Override
                    
354  public void testAnnotations_Cxtor() throws Exception {
                    
355    cxtorInjector = Guice.createInjector(new AbstractModule() {
                    
356      @Override
                    
415
                    
416    bindInjector = Guice.createInjector(new AbstractModule() {
                    
417      @Override
                    
432    try {
                    
433      Guice.createInjector(new AbstractModule() {
                    
434        @Override
                    
                
BoundFieldModuleTest.java https://gitlab.com/metamorphiccode/guice | Java | 753 lines
                    
122    BoundFieldModule module = BoundFieldModule.of(instance);
                    
123    Injector injector = Guice.createInjector(module);
                    
124
                    
316    try {
                    
317      Guice.createInjector(module);
                    
318      fail();
                    
364    BoundFieldModule module = BoundFieldModule.of(instance);
                    
365    Injector injector = Guice.createInjector(module);
                    
366
                    
470    BoundFieldModule module = BoundFieldModule.of(instance);
                    
471    Injector injector = Guice.createInjector(module);
                    
472
                    
482    BoundFieldModule module = BoundFieldModule.of(instance);
                    
483    Injector injector = Guice.createInjector(module);
                    
484
                    
                
ServletTest.java https://gitlab.com/metamorphiccode/guice | Java | 471 lines
                    
32import com.google.inject.CreationException;
                    
33import com.google.inject.Guice;
                    
34import com.google.inject.Inject;
                    
314
                    
315    GuiceFilter filter = new GuiceFilter();
                    
316    final boolean[] invoked = new boolean[1];
                    
339
                    
340    GuiceFilter filter = new GuiceFilter();
                    
341    final boolean[] invoked = new boolean[1];
                    
360
                    
361    GuiceFilter filter = new GuiceFilter();
                    
362    final boolean[] invoked = new boolean[1];
                    
385
                    
386    GuiceFilter filter = new GuiceFilter();
                    
387    final boolean[] invoked = new boolean[1];
                    
                
SpiUtils.java https://gitlab.com/metamorphiccode/guice | Java | 1117 lines
                    
1/**
                    
2 * Copyright (C) 2010 Google Inc.
                    
3 *
                    
16
                    
17package com.google.inject.multibindings;
                    
18
                    
18
                    
19import static com.google.inject.multibindings.MapBinder.entryOfProviderOf;
                    
20import static com.google.inject.multibindings.MapBinder.mapOf;
                    
54import com.google.inject.Binding;
                    
55import com.google.inject.Guice;
                    
56import com.google.inject.Injector;
                    
131      int expectedMapBindings, MapResult... results) {
                    
132    Injector injector = Guice.createInjector(modules);
                    
133    Visitor<T> visitor = new Visitor<T>();
                    
                
OptionalBinderTest.java https://gitlab.com/metamorphiccode/guice | Java | 1241 lines
                    
36import com.google.inject.CreationException;
                    
37import com.google.inject.Guice;
                    
38import com.google.inject.Injector;
                    
224    };
                    
225    Injector injector = Guice.createInjector(module);
                    
226    assertEquals("a", injector.getInstance(String.class));
                    
263    };
                    
264    Injector injector = Guice.createInjector(module);
                    
265    assertEquals("a", injector.getInstance(String.class));
                    
305    };
                    
306    Injector injector = Guice.createInjector(module);
                    
307    assertEquals("b", injector.getInstance(String.class));
                    
361
                    
362    Injector injector = Guice.createInjector(module1, module2, module3);
                    
363    assertEquals("b", injector.getInstance(String.class));
                    
                
MultibinderTest.java https://gitlab.com/metamorphiccode/guice | Java | 1221 lines
                    
41import com.google.inject.CreationException;
                    
42import com.google.inject.Guice;
                    
43import com.google.inject.Injector;
                    
119
                    
120    Injector injector = Guice.createInjector(abc, de);
                    
121    Key<Set<String>> setKey = Key.get(setOfString);
                    
141    };
                    
142    Injector injector = Guice.createInjector(module);
                    
143
                    
163    };
                    
164    Injector injector = Guice.createInjector(module);
                    
165
                    
188    };
                    
189    Injector injector = Guice.createInjector(module);
                    
190
                    
                
MapBinderTest.java https://gitlab.com/metamorphiccode/guice | Java | 1032 lines
                    
39import com.google.inject.CreationException;
                    
40import com.google.inject.Guice;
                    
41import com.google.inject.Inject;
                    
234    };
                    
235    Injector injector = Guice.createInjector(module);
                    
236
                    
262    };
                    
263    Injector injector = Guice.createInjector(module);
                    
264
                    
297    };
                    
298    Injector injector = Guice.createInjector(module);
                    
299
                    
326    };
                    
327    Injector injector = Guice.createInjector(module);
                    
328
                    
                
FactoryProviderTest.java https://gitlab.com/metamorphiccode/guice | Java | 840 lines
                    
54  public void testAssistedFactory() {
                    
55    Injector injector = Guice.createInjector(new AbstractModule() {
                    
56      @Override
                    
90  public void testAssistedFactoryWithAnnotations() {
                    
91    Injector injector = Guice.createInjector(new AbstractModule() {
                    
92      @Override
                    
359  public void testAssistInjectionInNonPublicConstructor() {
                    
360    Injector injector = Guice.createInjector(new AbstractModule() {
                    
361      @Override
                    
377  public void testExceptionDuringConstruction() {
                    
378    Injector injector = Guice.createInjector(new AbstractModule() {
                    
379      @Override
                    
424  public void testConstructorExceptionsAreThrownByFactory() {
                    
425    Injector injector = Guice.createInjector(new AbstractModule() {
                    
426      @Override
                    
                
FactoryProvider2Test.java https://gitlab.com/metamorphiccode/guice | Java | 1220 lines
                    
50  public void testAssistedFactory() {
                    
51    Injector injector = Guice.createInjector(new AbstractModule() {
                    
52      @Override
                    
356  public void testAssistInjectionInNonPublicConstructor() {
                    
357    Injector injector = Guice.createInjector(new AbstractModule() {
                    
358      @Override
                    
375  public void testExceptionDuringConstruction() {
                    
376    Injector injector = Guice.createInjector(new AbstractModule() {
                    
377      @Override
                    
413  public void testConstructorExceptionsAreThrownByFactory() {
                    
414    Injector injector = Guice.createInjector(new AbstractModule() {
                    
415      @Override
                    
440  public void testWildcardGenerics() {
                    
441    Injector injector = Guice.createInjector(new AbstractModule() {
                    
442      @Override
                    
                
FactoryModuleBuilderTest.java https://gitlab.com/metamorphiccode/guice | Java | 540 lines
                    
56    try {
                    
57      Guice.createInjector(new AbstractModule() {
                    
58        @Override
                    
274    try {
                    
275      Injector injector = Guice.createInjector(new AbstractModule() {
                    
276        @Override
                    
295  public void testMultipleReturnTypes() {
                    
296    Injector injector = Guice.createInjector(new AbstractModule() {
                    
297      @Override
                    
313  public void testParameterizedClassesWithNoImplements() {
                    
314    Injector injector = Guice.createInjector(new AbstractModule() {
                    
315      @Override
                    
327    try {
                    
328      Guice.createInjector(new AbstractModule() {
                    
329        @Override
                    
                
OverrideModuleTest.java https://gitlab.com/metamorphiccode/guice | Java | 731 lines
                    
20import static com.google.inject.Asserts.assertContains;
                    
21import static com.google.inject.Guice.createInjector;
                    
22import static com.google.inject.name.Names.named;
                    
33import com.google.inject.Exposed;
                    
34import com.google.inject.Guice;
                    
35import com.google.inject.Injector;
                    
365    value.set("B");
                    
366    Injector injector = Guice.createInjector(overridden);
                    
367    assertEquals("B", injector.getInstance(Key.get(String.class, named("original"))));
                    
413    // override forwards
                    
414    Injector injector = Guice.createInjector(Modules.override(exposes5and6).with(exposes15));
                    
415    assertEquals(15, injector.getInstance(Integer.class).intValue());
                    
418    // and in reverse order
                    
419    Injector reverse = Guice.createInjector(Modules.override(exposes15).with(exposes5and6));
                    
420    assertEquals(5, reverse.getInstance(Integer.class).intValue());
                    
                
SpiBindingsTest.java https://gitlab.com/metamorphiccode/guice | Java | 463 lines
                    
26import com.google.inject.Binding;
                    
27import com.google.inject.Guice;
                    
28import com.google.inject.Inject;
                    
29import com.google.inject.Injector;
                    
30import com.google.inject.Key;
                    
31import com.google.inject.Module;
                    
244  public void testConvertedConstantBinding() {
                    
245    Injector injector = Guice.createInjector(new AbstractModule() {
                    
246      protected void configure() {
                    
265  public void testProviderBinding() {
                    
266    Injector injector = Guice.createInjector(new AbstractModule() {
                    
267      protected void configure() {
                    
356    
                    
357    final Injector injector = Guice.createInjector(new AbstractModule() {
                    
358      protected void configure() {
                    
                
ProviderMethodsTest.java https://gitlab.com/metamorphiccode/guice | Java | 952 lines
                    
72  public void testProviderMethods() {
                    
73    Injector injector = Guice.createInjector(this);
                    
74
                    
361
                    
362    Injector injector = Guice.createInjector(module);
                    
363
                    
383    try {
                    
384      Guice.createInjector(new AbstractModule() {
                    
385        @Override protected void configure() {}
                    
398    AtomicReference<Logger> loggerRef = new AtomicReference<Logger>();
                    
399    Injector injector = Guice.createInjector(new FooModule(loggerRef));
                    
400
                    
435    };
                    
436    Injector injector = Guice.createInjector(m1, m2);
                    
437
                    
                
WeakKeySetTest.java https://gitlab.com/metamorphiccode/guice | Java | 528 lines
                    
23import static com.google.inject.internal.WeakKeySetUtils.assertNotBlacklisted;
                    
24import static com.google.inject.internal.WeakKeySetUtils.assertNotInSet;
                    
25import static com.google.inject.internal.WeakKeySetUtils.assertSourceNotInSet;
                    
31import com.google.inject.Binding;
                    
32import com.google.inject.Guice;
                    
33import com.google.inject.Injector;
                    
336  public void testWeakKeySet_integration() {
                    
337    Injector parentInjector = Guice.createInjector(new AbstractModule() {
                    
338          @Override protected void configure() {
                    
358  public void testWeakKeySet_integration_multipleChildren() {
                    
359    Injector parentInjector = Guice.createInjector(new AbstractModule() {
                    
360          @Override protected void configure() {
                    
398  public void testWeakKeySet_integration_multipleChildren_overlappingKeys() {
                    
399    Injector parentInjector = Guice.createInjector(new AbstractModule() {
                    
400          @Override protected void configure() {
                    
                
TypeListenerTest.java https://gitlab.com/metamorphiccode/guice | Java | 710 lines
                    
96
                    
97    Guice.createInjector(new AbstractModule() {
                    
98      @Override protected void configure() {
                    
288    try {
                    
289      Guice.createInjector(new AbstractModule() {
                    
290        @Override protected void configure() {
                    
315
                    
316    Injector injector = Guice.createInjector(new AbstractModule() {
                    
317      @Override protected void configure() {
                    
375
                    
376    Guice.createInjector(new AbstractModule() {
                    
377      @Override protected void configure() {
                    
413  public void testLookupsPostCreate() {
                    
414    Injector injector = Guice.createInjector(new AbstractModule() {
                    
415      @Override protected void configure() {
                    
                
TypeConversionTest.java https://gitlab.com/metamorphiccode/guice | Java | 495 lines
                    
76  public void testOneConstantInjection() throws CreationException {
                    
77    Injector injector = Guice.createInjector(new AbstractModule() {
                    
78      @Override protected void configure() {
                    
215  public void testInvalidEnum() throws CreationException {
                    
216    Injector injector = Guice.createInjector(new AbstractModule() {
                    
217      @Override protected void configure() {
                    
253
                    
254    Injector injector = Guice.createInjector(new AbstractModule() {
                    
255      @Override protected void configure() {
                    
330    try {
                    
331      Guice.createInjector(new OuterModule(new ConverterNullModule()));
                    
332      fail();
                    
387
                    
388    Injector injector = Guice.createInjector(new AbstractModule() {
                    
389      @Override protected void configure() {
                    
                
ScopesTest.java https://gitlab.com/metamorphiccode/guice | Java | 1192 lines
                    
123  public void testJustInTimeAnnotatedSingleton() {
                    
124    Injector injector = Guice.createInjector();
                    
125
                    
132    assertNotSame(
                    
133        Guice.createInjector().getInstance(AnnotatedSingleton.class),
                    
134        Guice.createInjector().getInstance(AnnotatedSingleton.class));
                    
222    try {
                    
223      Guice.createInjector(new AbstractModule() {
                    
224        @Override protected void configure() {
                    
326    try {
                    
327      Guice.createInjector(new OuterDeprecatedModule());
                    
328      fail();
                    
424  public void testSingletonAnnotationOnParameterizedType() {
                    
425    Injector injector = Guice.createInjector();
                    
426    assertSame(injector.getInstance(new Key<Injected<String>>() {}),
                    
                
ProvisionListenerTest.java https://gitlab.com/metamorphiccode/guice | Java | 796 lines
                    
51  public void testExceptionInListenerBeforeProvisioning() {
                    
52    Injector injector = Guice.createInjector(new AbstractModule() {
                    
53      @Override
                    
277    final Counter count2 = new Counter();
                    
278    Injector injector = Guice.createInjector(new AbstractModule() {
                    
279      @Override
                    
302    final Capturer capturer = new Capturer();
                    
303    Injector injector = Guice.createInjector(new AbstractModule() {
                    
304      @Override
                    
362    final Counter counter = new Counter();
                    
363    Injector injector = Guice.createInjector(new AbstractModule() {
                    
364      @Override
                    
383  public void testCallingBindingDotGetProviderDotGet() {
                    
384    Injector injector = Guice.createInjector(new AbstractModule() {
                    
385      @Override
                    
                
ProvisionExceptionTest.java https://gitlab.com/metamorphiccode/guice | Java | 470 lines
                    
120    try {
                    
121      Guice.createInjector(new AbstractModule() {
                    
122        @Override protected void configure() {
                    
278    final RuntimeException sharedException = new RuntimeException("fail");
                    
279    Injector injector = Guice.createInjector(new AbstractModule() {
                    
280      @Override protected void configure() {}
                    
302    final RuntimeException exception2 = new RuntimeException("abort");
                    
303    Injector injector = Guice.createInjector(new AbstractModule() {
                    
304      @Override protected void configure() {}
                    
339  public void testDuplicatesDifferentInstances() {
                    
340    Injector injector = Guice.createInjector(new AbstractModule() {
                    
341      @Override protected void configure() {}
                    
359  public void testMultipleDuplicatesDifferentInstaces() {
                    
360    Injector injector = Guice.createInjector(new AbstractModule() {
                    
361      @Override protected void configure() {}
                    
                
PrivateModuleTest.java https://gitlab.com/metamorphiccode/guice | Java | 564 lines
                    
231    try {
                    
232      Guice.createInjector(
                    
233          new PrivateModule() {
                    
274  public void testInstallingRegularModulesFromPrivateModules() {
                    
275    Injector injector = Guice.createInjector(new PrivateModule() {
                    
276      @Override public void configure() {
                    
326  public void testDependenciesBetweenPrivateAndPublic() {
                    
327    Injector injector = Guice.createInjector(
                    
328        new PrivateModule() {
                    
355  public void testDependenciesBetweenPrivateAndPublicWithPublicEagerSingleton() {
                    
356    Injector injector = Guice.createInjector(
                    
357        new PrivateModule() {
                    
392  public void testDependenciesBetweenPrivateAndPublicWithPrivateEagerSingleton() {
                    
393    Injector injector = Guice.createInjector(
                    
394        new AbstractModule() {
                    
                
JitBindingsTest.java https://gitlab.com/metamorphiccode/guice | Java | 731 lines
                    
160    try {
                    
161      Guice.createInjector(new AbstractModule() {
                    
162        @Override
                    
176  public void testLinkedProviderBindingWorks() {
                    
177    Injector injector = Guice.createInjector(new AbstractModule() {
                    
178      @Override
                    
192    try {
                    
193      Guice.createInjector(new AbstractModule() {
                    
194        @Override
                    
267  public void testImplementedBySomethingThatIsAnnotated() {
                    
268    Injector injector = Guice.createInjector(new AbstractModule() {
                    
269      @Override
                    
403    try {
                    
404      Guice.createInjector(new AbstractModule() {
                    
405        protected void configure() {
                    
                
DuplicateBindingsTest.java https://gitlab.com/metamorphiccode/guice | Java | 576 lines
                    
100    
                    
101    Guice.createInjector(
                    
102        new ScopedModule(Scopes.NO_SCOPE, foo, pFoo, pclFoo, clFoo, cFoo),
                    
107  public void testSameScopeAnnotationIgnored() {
                    
108    Guice.createInjector(
                    
109        new AnnotatedScopeModule(Singleton.class, foo, pFoo, pclFoo, clFoo, cFoo),
                    
189  public void testChildInjectorDuplicateParentFail() {
                    
190    Injector injector = Guice.createInjector(
                    
191        new SimpleModule(foo, pFoo, pclFoo, clFoo, cFoo)
                    
235        try {
                    
236          Guice.createInjector(Elements.getModule(Arrays.asList(e1, e2)));
                    
237          if(e1 != e2) {
                    
312    b.equality = "test";
                    
313    Guice.createInjector(new AbstractModule() {
                    
314      @Override
                    
                
CircularDependencyTest.java https://gitlab.com/metamorphiccode/guice | Java | 652 lines
                    
206    try {
                    
207      Guice.createInjector().getInstance(C.class);
                    
208      fail();
                    
217    try {
                    
218      Guice.createInjector(new AbstractModule() {
                    
219        @Override protected void configure() {}
                    
232    try {
                    
233      Guice.createInjector(new AbstractModule() {
                    
234        @Override protected void configure() {
                    
322    try {
                    
323      Guice.createInjector(new AbstractModule() {
                    
324        @Override protected void configure() {
                    
338    try {
                    
339      Guice.createInjector(new AbstractModule() {
                    
340        @Override
                    
                
BindingTest.java https://gitlab.com/metamorphiccode/guice | Java | 503 lines
                    
126  public void testScopeIsAppliedToKeyNotTarget() {
                    
127    Injector injector = Guice.createInjector(new AbstractModule() {
                    
128      protected void configure() {
                    
195  private void assertBindingSucceeds(final Class<?> clazz) {
                    
196    assertNotNull(Guice.createInjector().getInstance(clazz));
                    
197  }
                    
292
                    
293    Injector injector = Guice.createInjector(new AbstractModule() {
                    
294      protected void configure() {
                    
327
                    
328    Injector injector = Guice.createInjector(new AbstractModule() {
                    
329      protected void configure() {
                    
465  public void testTurkeyBaconProblemUsingToConstuctor() {
                    
466    Injector injector = Guice.createInjector(new AbstractModule() {
                    
467      @SuppressWarnings("unchecked")
                    
                
BinderTestSuite.java https://gitlab.com/metamorphiccode/guice | Java | 769 lines
                    
1/**
                    
2 * Copyright (C) 2008 Google Inc.
                    
3 *
                    
18
                    
19import static com.google.inject.Asserts.assertContains;
                    
20import static com.google.inject.name.Names.named;
                    
24
                    
25import com.google.common.collect.ImmutableList;
                    
26import com.google.common.collect.Lists;
                    
26import com.google.common.collect.Lists;
                    
27import com.google.inject.binder.AnnotatedBindingBuilder;
                    
28import com.google.inject.binder.ScopedBindingBuilder;
                    
399      nextId.set(101);
                    
400      return Guice.createInjector(modules);
                    
401    }
                    
                
BinderTest.java https://gitlab.com/metamorphiccode/guice | Java | 634 lines
                    
91    try {
                    
92      Guice.createInjector(new AbstractModule() {
                    
93        @Override
                    
128    try {
                    
129      Guice.createInjector(new AbstractModule() {
                    
130        @Override
                    
250
                    
251    Injector injector = Guice.createInjector(new AbstractModule() {
                    
252      @Override
                    
362   * See issue 614, Problem One
                    
363   * https://github.com/google/guice/issues/614
                    
364   */
                    
418  public void testPartialInjectorGetInstance() {
                    
419    Injector injector = Guice.createInjector();
                    
420    try {
                    
                
Errors.java https://gitlab.com/metamorphiccode/guice | Java | 870 lines
                    
26import com.google.common.collect.Ordering;
                    
27import com.google.inject.ConfigurationException;
                    
28import com.google.inject.CreationException;
                    
28import com.google.inject.CreationException;
                    
29import com.google.inject.Guice;
                    
30import com.google.inject.Key;
                    
34import com.google.inject.ProvisionException;
                    
35import com.google.inject.Scope;
                    
36import com.google.inject.TypeLiteral;
                    
139   * same message for both bind time errors:
                    
140   * <pre><code>Guice.createInjector(new AbstractModule() {
                    
141   *   public void configure() {
                    
145   * ...and at provide-time errors:
                    
146   * <pre><code>Guice.createInjector().getInstance(Runnable.class);</code></pre>
                    
147   * Otherwise we need to know who's calling when resolving a just-in-time
                    
                
VAppHandlerTest.java https://github.com/arohner/jclouds.git | Java | 196 lines
                    
20
                    
21import static com.google.common.collect.Iterables.find;
                    
22import static org.testng.Assert.assertEquals;
                    
45
                    
46import com.google.common.collect.ImmutableList;
                    
47import com.google.common.collect.ImmutableSet;
                    
47import com.google.common.collect.ImmutableSet;
                    
48import com.google.common.collect.Iterables;
                    
49import com.google.common.collect.Lists;
                    
50import com.google.inject.AbstractModule;
                    
51import com.google.inject.Guice;
                    
52import com.google.inject.name.Names;
                    
65   protected void setUpInjector() {
                    
66      injector = Guice.createInjector(new SaxParserModule(), new AbstractModule() {
                    
67
                    
                
Errors.java https://gitlab.com/sharadag/elasticsearch | Java | 658 lines
                    
1/*
                    
2 * Copyright (C) 2006 Google Inc.
                    
3 *
                    
65 *
                    
66 * @author jessewilson@google.com (Jesse Wilson)
                    
67 */
                    
119     * same message for both bind time errors:
                    
120     * <pre><code>Guice.createInjector(new AbstractModule() {
                    
121     *   public void configure() {
                    
125     * ...and at provide-time errors:
                    
126     * <pre><code>Guice.createInjector().getInstance(Runnable.class);</code></pre>
                    
127     * Otherwise we need to know who's calling when resolving a just-in-time
                    
200
                    
201    public Errors cannotBindToGuiceType(String simpleName) {
                    
202        return addMessage("Binding to core guice framework type is not allowed: %s.", simpleName);
                    
                
RoboGuice.java https://code.google.com/p/roboguice/ | Java | 218 lines
                    
67     *
                    
68     * RoboGuice.setAppliationInjector( app, RoboGuice.DEFAULT_STAGE, Modules.override(RoboGuice.newDefaultRoboModule(app)).with(new MyModule() );
                    
69     *
                    
70     * @see com.google.inject.util.Modules#override(com.google.inject.Module...)
                    
71     * @see roboguice.RoboGuice#setBaseApplicationInjector(android.app.Application, com.google.inject.Stage, com.google.inject.Module...)
                    
72     * @see roboguice.RoboGuice#newDefaultRoboModule(android.app.Application)
                    
72     * @see roboguice.RoboGuice#newDefaultRoboModule(android.app.Application)
                    
73     * @see roboguice.RoboGuice#DEFAULT_STAGE
                    
74     *
                    
74     *
                    
75     * If using this method with test cases, be sure to call {@link roboguice.RoboGuice.util#reset()} in your test teardown methods
                    
76     * to avoid polluting our other tests with your custom injector.  Don't do this in your real application though.
                    
93        synchronized (RoboGuice.class) {
                    
94            final Injector rtrn = Guice.createInjector(stage, modules);
                    
95            injectors.put(application,rtrn);
                    
                
BundleActivation.java https://github.com/sonatype/sonatype-peaberry.git | Java | 193 lines
                    
29import com.google.inject.Binding;
                    
30import com.google.inject.Guice;
                    
31import com.google.inject.Injector;
                    
31import com.google.inject.Injector;
                    
32import com.google.inject.Key;
                    
33import com.google.inject.Module;
                    
34import com.google.inject.Scope;
                    
35import com.google.inject.Scopes;
                    
36import com.google.inject.Singleton;
                    
36import com.google.inject.Singleton;
                    
37import com.google.inject.spi.BindingScopingVisitor;
                    
38
                    
159    injector =
                    
160        Guice.createInjector(Peaberry.osgiModule(bundle.getBundleContext()), Reflection
                    
161            .create(moduleClass));
                    
                
TestJsonModule.java https://gitlab.com/CORP-RESELLER/airlift | Java | 389 lines
                    
25import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
                    
26import com.google.common.base.Joiner;
                    
27import com.google.common.base.Splitter;
                    
27import com.google.common.base.Splitter;
                    
28import com.google.common.collect.ImmutableList;
                    
29import com.google.common.collect.ImmutableSet;
                    
31import com.google.inject.Binder;
                    
32import com.google.inject.Guice;
                    
33import com.google.inject.Injector;
                    
64    {
                    
65        Injector injector = Guice.createInjector(new JsonModule(),
                    
66                new Module()
                    
81    {
                    
82        Injector injector = Guice.createInjector(new JsonModule());
                    
83        JsonCodecFactory codecFactory = injector.getInstance(JsonCodecFactory.class);
                    
                
ImplicitBindingTest.java https://gitlab.com/metamorphiccode/guice | Java | 403 lines
                    
33  public void testCircularDependency() throws CreationException {
                    
34    Injector injector = Guice.createInjector();
                    
35    Foo foo = injector.getInstance(Foo.class);
                    
76  public void testBindingOverridesImplementedBy() {
                    
77    Injector injector = Guice.createInjector(new AbstractModule() {
                    
78      @Override
                    
92    try {
                    
93      Guice.createInjector().getInstance(Key.get(I.class, Names.named("i")));
                    
94      fail();
                    
253    // If it still occurs, the bug will explode here.
                    
254    Injector childSetupRootInjector = Guice.createInjector();
                    
255    Injector childSetupChildInjector = childSetupRootInjector.createChildInjector(testModule);      
                    
396  public void testImplicitJdkBindings() {
                    
397    Injector injector = Guice.createInjector();
                    
398    // String has a public nullary constructor, so Guice will call it.
                    
                
TestHttpServiceSelectorBinder.java https://gitlab.com/CORP-RESELLER/airlift | Java | 194 lines
                    
21import com.google.inject.Binder;
                    
22import com.google.inject.Guice;
                    
23import com.google.inject.Injector;
                    
45    {
                    
46        Injector injector = Guice.createInjector(
                    
47                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
122    {
                    
123        Injector injector = Guice.createInjector(
                    
124                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
147    {
                    
148        Injector injector = Guice.createInjector(
                    
149                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
172    {
                    
173        Injector injector = Guice.createInjector(
                    
174                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    
                
MultibindTests.java https://github.com/manzke/guice-automatic-injection.git | Java | 209 lines
                    
30import com.google.inject.ConfigurationException;
                    
31import com.google.inject.Guice;
                    
32import com.google.inject.Injector;
                    
41	public void createDynamicModule() {
                    
42		Injector injector = Guice.createInjector(StartupModule.create(ReflectionsScanner.class,
                    
43			PackageFilter.create(MultibindTests.class)));
                    
48	public void testWithWrongPackage1() {
                    
49		Injector injector = Guice.createInjector(StartupModule.create(ReflectionsScanner.class,
                    
50			PackageFilter.create("java.util.concurrent")));
                    
94	public void createSecondTestInterface() {
                    
95		Injector injector = Guice.createInjector(StartupModule.create(ReflectionsScanner.class,
                    
96			PackageFilter.create(MultibindTests.class)));
                    
110	public void createAllInterfaces() {
                    
111		Injector injector = Guice.createInjector(StartupModule.create(ReflectionsScanner.class,
                    
112			PackageFilter.create(MultibindTests.class)));
                    
                
TestOverrideMethodFilterInHttpServer.java https://gitlab.com/CORP-RESELLER/airlift | Java | 290 lines
                    
18import com.google.inject.Binder;
                    
19import com.google.inject.Guice;
                    
20import com.google.inject.Module;
                    
275    {
                    
276        return Guice.createInjector(
                    
277                new TestingNodeModule(),
                    
                
GitblitContext.java https://gitlab.com/tigefa/gitblit | Java | 511 lines
                    
43import com.gitblit.extensions.LifeCycleListener;
                    
44import com.gitblit.guice.CoreModule;
                    
45import com.gitblit.guice.WebModule;
                    
62import com.google.inject.AbstractModule;
                    
63import com.google.inject.Guice;
                    
64import com.google.inject.Injector;
                    
64import com.google.inject.Injector;
                    
65import com.google.inject.servlet.GuiceServletContextListener;
                    
66
                    
77 */
                    
78public class GitblitContext extends GuiceServletContextListener {
                    
79
                    
126	protected Injector getInjector() {
                    
127		return Guice.createInjector(getModules());
                    
128	}
                    
                
ParseImageFromJsonResponseTest.java https://github.com/arohner/jclouds.git | Java | 92 lines
                    
37import com.google.inject.AbstractModule;
                    
38import com.google.inject.Guice;
                    
39import com.google.inject.Injector;
                    
39import com.google.inject.Injector;
                    
40import com.google.inject.Key;
                    
41import com.google.inject.TypeLiteral;
                    
49public class ParseImageFromJsonResponseTest {
                    
50   Injector i = Guice.createInjector(new AbstractModule() {
                    
51
                    
74   public static Image parseImage() {
                    
75      Injector i = Guice.createInjector(new AbstractModule() {
                    
76
                    
                
AWSMarketplaceCommerceAnalyticsModuleInjector.java https://gitlab.com/github-cloud-corp/aws-sdk-java | Java | 50 lines
                    
17import com.google.inject.AbstractModule;
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.Stage;
                    
21
                    
21
                    
22import cucumber.api.guice.CucumberModules;
                    
23import cucumber.runtime.java.guice.InjectorSource;
                    
37    public Injector getInjector() {
                    
38        return Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO,
                    
39                new AWSMarketplaceCommerceAnalyticsModule());
                    
                
GuiceResolver.java https://gitlab.com/essere.lab.public/qualitas.class-corpus | Java | 115 lines
                    
30
                    
31import com.google.inject.Injector;
                    
32
                    
37 * 
                    
38 * &ltapplication> &ltel-resolver>org.apache.myfaces.el.unified.resolver.GuiceResolver&lt/el-resolver> &lt/application>
                    
39 * 
                    
43 * 
                    
44 * &ltlistener> <listener-class>com.your_company.GuiceServletContextListener&lt/listener-class> &lt/listener>
                    
45 * 
                    
46 * <p>
                    
47 * Configure Guice in your ServletContextListener implementation, and place the Injector in application scope.
                    
48 * </p>
                    
52 * public void contextInitialized(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); //when on
                    
53 * Java6, use ServiceLoader.load(com.google.inject.Module.class); Injector injector = Guice.createInjector(new
                    
54 * YourModule()); ctx.setAttribute(GuiceResolver.KEY, injector); }
                    
                
Initializer.java https://github.com/WIZARDISHUNGRY/limewire.git | Java | 634 lines
                    
51import com.google.inject.AbstractModule;
                    
52import com.google.inject.Guice;
                    
53import com.google.inject.Injector;
                    
53import com.google.inject.Injector;
                    
54import com.google.inject.Stage;
                    
55import com.limegroup.gnutella.ActiveLimeWireCheck;
                    
357        stopwatch.reset();
                    
358        Injector injector = Guice.createInjector(Stage.PRODUCTION, new LimeWireModule(), new AbstractModule() {
                    
359            @Override
                    
367    
                    
368    /** Wires together remaining non-Guiced pieces. */
                    
369    private void glueCore(LimeWireCore limeWireCore) {
                    
                
TestConfig.java https://gitlab.com/CORP-RESELLER/airlift | Java | 141 lines
                    
17
                    
18import com.google.common.collect.ImmutableMap;
                    
19import com.google.common.collect.ImmutableMap.Builder;
                    
19import com.google.common.collect.ImmutableMap.Builder;
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.CreationException;
                    
21import com.google.inject.CreationException;
                    
22import com.google.inject.Guice;
                    
23import com.google.inject.Injector;
                    
23import com.google.inject.Injector;
                    
24import com.google.inject.Module;
                    
25import com.google.inject.spi.Message;
                    
92        List<Message> messages = new ConfigurationValidator(configurationFactory, null).validate(module);
                    
93        return Guice.createInjector(new ConfigurationModule(configurationFactory), module, new ValidationErrorModule(messages));
                    
94    }
                    
                
BindGroupToUpdateRequestJsonPayloadTest.java https://github.com/jclouds/legacy-jclouds-chef.git | Java | 90 lines
                    
34
                    
35import com.google.common.collect.ImmutableSet;
                    
36import com.google.inject.AbstractModule;
                    
36import com.google.inject.AbstractModule;
                    
37import com.google.inject.Guice;
                    
38import com.google.inject.Injector;
                    
47
                    
48   private Injector injector = Guice.createInjector(new AbstractModule() {
                    
49      @Override
                    
                
BTDownloaderImplTest.java https://github.com/r3n/limewire5-ruby.git | Java | 395 lines
                    
13
                    
14import com.google.inject.Guice;
                    
15import com.google.inject.Injector;
                    
15import com.google.inject.Injector;
                    
16import com.google.inject.Stage;
                    
17import com.limegroup.gnutella.ActivityCallbackAdapter;
                    
358        AssertComparisons.assertTrue(torrentFile.exists());
                    
359        Injector injector = Guice.createInjector(Stage.PRODUCTION, new LimeWireCoreModule(
                    
360                ActivityCallbackAdapter.class));
                    
                
Activator.java https://bitbucket.org/gcubar/eclipselabs.org-spray.git | Java | 54 lines
                    
11
                    
12import com.google.inject.Guice;
                    
13import com.google.inject.Injector;
                    
13import com.google.inject.Injector;
                    
14import com.google.inject.Module;
                    
15
                    
50        Module module = Modules3.mixin(new SprayRuntimeModule(), new GraphitiRuntimeModule(), new GraphitiGeneratorModule(), new GraphitiGeneratorUIModule(this), new SharedStateModule()/* , new SprayUiModule(this) */);
                    
51        injector = Guice.createInjector(module);
                    
52        injector.injectMembers(this);
                    
                
NamesTest.java https://gitlab.com/metamorphiccode/guice | Java | 112 lines
                    
20import static com.google.inject.Asserts.assertEqualWhenReserialized;
                    
21import static com.google.inject.Asserts.assertEqualsBothWays;
                    
22
                    
24import com.google.inject.AbstractModule;
                    
25import com.google.inject.Guice;
                    
26import com.google.inject.Injector;
                    
62
                    
63    Injector injector = Guice.createInjector(new AbstractModule() {
                    
64      protected void configure() {
                    
76
                    
77    Injector injector = Guice.createInjector(new AbstractModule() {
                    
78      protected void configure() {
                    
95
                    
96    Injector injector = Guice.createInjector(new AbstractModule() {
                    
97      protected void configure() {
                    
                
ExtensionSpiTest.java https://github.com/sonatype/sisu-guice.git | Java | 293 lines
                    
18
                    
19import static com.google.inject.servlet.UriPatternType.REGEX;
                    
20import static com.google.inject.servlet.UriPatternType.SERVLET;
                    
21
                    
22import com.google.common.collect.ImmutableList;
                    
23import com.google.common.collect.ImmutableMap;
                    
24import com.google.inject.Binding;
                    
25import com.google.inject.Guice;
                    
26import com.google.inject.Injector;
                    
26import com.google.inject.Injector;
                    
27import com.google.inject.Key;
                    
28import com.google.inject.name.Names;
                    
66    int count = 0;
                    
67    Injector injector = Guice.createInjector(new Module());
                    
68    for (Binding binding : injector.getBindings().values()) {
                    
                
Guice1TestPlugin.java http://mycila.googlecode.com/svn/ | Java | 178 lines
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Inject;
                    
23import com.google.inject.Injector;
                    
24import com.google.inject.Module;
                    
25import com.google.inject.Provider;
                    
46
                    
47    public static final String INJECTOR = "com.google.inject.Injector";
                    
48
                    
51        context.attributes().set("guice.providers", new ArrayList<Provider<?>>());
                    
52        GuiceContext ctx = context.introspector().testClass().getAnnotation(GuiceContext.class);
                    
53
                    
77        // create injector
                    
78        Injector injector = Guice.createInjector(findStage(ctx), modules);
                    
79        context.attributes().set(INJECTOR, injector);
                    
                
EventPublisherTest.java https://github.com/frodooooo39/smart-cms.git | Java | 218 lines
                    
21import com.google.inject.AbstractModule;
                    
22import com.google.inject.Guice;
                    
23import com.google.inject.Injector;
                    
58  public void setup() {
                    
59    injector = Guice.createInjector(new EventPublicationListenerModule());
                    
60  }
                    
                
DefaultPluginManager.java http://mycila.googlecode.com/svn/ | Java | 199 lines
                    
19import com.google.inject.Binder;
                    
20import com.google.inject.Guice;
                    
21import com.google.inject.Injector;
                    
21import com.google.inject.Injector;
                    
22import com.google.inject.Key;
                    
23import com.google.inject.Module;
                    
23import com.google.inject.Module;
                    
24import com.google.inject.Singleton;
                    
25import com.google.inject.Stage;
                    
25import com.google.inject.Stage;
                    
26import com.mycila.guice.CyclicPluginDependencyException;
                    
27import com.mycila.guice.InvokeException;
                    
127        });
                    
128        return Guice.createInjector(Stage.PRODUCTION, mm);
                    
129    }
                    
                
ManyConstructorsTest.java https://gitlab.com/metamorphiccode/guice | Java | 277 lines
                    
32  public void testTwoConstructors() {
                    
33    Injector injector = Guice.createInjector(new AbstractModule() {
                    
34      @Override
                    
48  public void testDifferentOrderParameters() {
                    
49    Injector injector = Guice.createInjector(new AbstractModule() {
                    
50      @Override
                    
96    
                    
97    injector = Guice.createInjector(new AbstractModule() {
                    
98      @Override
                    
110    try {
                    
111      Guice.createInjector(new AbstractModule() {
                    
112        @Override
                    
229  public void testDependenciesAndOtherAnnotations() {
                    
230    Injector injector = Guice.createInjector(new AbstractModule() {
                    
231      @Override
                    
                
VDCHandlerTest.java https://github.com/arohner/jclouds.git | Java | 81 lines
                    
36import com.google.common.collect.ImmutableMap;
                    
37import com.google.inject.Guice;
                    
38import com.google.inject.Injector;
                    
49      InputStream is = getClass().getResourceAsStream("/vdc.xml");
                    
50      Injector injector = Guice.createInjector(new SaxParserModule());
                    
51      Factory factory = injector.getInstance(ParseSax.Factory.class);
                    
                
CheckedProviderMethodsModuleTest.java https://gitlab.com/metamorphiccode/guice | Java | 195 lines
                    
125  public void testNoAnnotationNoScope() throws BindException, RemoteException {
                    
126    Injector injector = Guice.createInjector(new TestModule());
                    
127    RpcProvider<String> provider = injector
                    
146    TestModule testModule = new TestModule();
                    
147    Injector injector = Guice.createInjector(testModule);
                    
148    RpcProvider<Long> provider = injector
                    
154    TestModule testModule = new TestModule();
                    
155    Injector injector = Guice.createInjector(testModule);
                    
156    RpcProvider<Pair<Double, String>> provider = injector
                    
163    TestModule testModule = new TestModule();
                    
164    Injector injector = Guice.createInjector(testModule);
                    
165    RpcProvider<Float> provider = injector
                    
178    TestModule testModule = new TestModule();
                    
179    Injector injector = Guice.createInjector(testModule);
                    
180    RpcProvider<String> provider = injector
                    
                
GenericInjectionTest.java https://gitlab.com/metamorphiccode/guice | Java | 187 lines
                    
38
                    
39    Injector injector = Guice.createInjector((Module) new AbstractModule() {
                    
40      protected void configure() {
                    
59    Parameterized<String> parameterized
                    
60        = Guice.createInjector().getInstance(Key.get(new TypeLiteral<Parameterized<String>>() {}));
                    
61    assertNotNull(parameterized);
                    
64  public void testExplicitBindingOfGenericType() {
                    
65    Injector injector = Guice.createInjector(new AbstractModule() {
                    
66      protected void configure() {
                    
145
                    
146    Injector injector = Guice.createInjector(bindDataModule, bindingModule);
                    
147    ParameterizedDeps<String, Integer> parameterizedDeps
                    
174  public void testImmediateTypeVariablesAreInjected() {
                    
175    Injector injector = Guice.createInjector(new AbstractModule() {
                    
176      protected void configure() {
                    
                
Activator.java https://github.com/sonatype/sonatype-peaberry.git | Java | 157 lines
                    
18
                    
19import static com.google.inject.name.Names.named;
                    
20import static java.lang.Math.max;
                    
35import com.google.inject.AbstractModule;
                    
36import com.google.inject.Guice;
                    
37import com.google.inject.Inject;
                    
37import com.google.inject.Inject;
                    
38import com.google.inject.Injector;
                    
39import com.google.inject.Key;
                    
39import com.google.inject.Key;
                    
40import com.google.inject.TypeLiteral;
                    
41import com.google.inject.name.Named;
                    
114  public void start(final BundleContext context) {
                    
115    final Injector injector = Guice.createInjector(osgiModule(context), new AbstractModule() {
                    
116      @Override
                    
                
BoundFieldModule.java https://gitlab.com/metamorphiccode/guice | Java | 385 lines
                    
19import com.google.common.base.Optional;
                    
20import com.google.common.base.Preconditions;
                    
21import com.google.inject.Binder;
                    
21import com.google.inject.Binder;
                    
22import com.google.inject.BindingAnnotation;
                    
23import com.google.inject.Module;
                    
24import com.google.inject.Provider;
                    
25import com.google.inject.TypeLiteral;
                    
26import com.google.inject.binder.AnnotatedBindingBuilder;
                    
26import com.google.inject.binder.AnnotatedBindingBuilder;
                    
27import com.google.inject.binder.LinkedBindingBuilder;
                    
28import com.google.inject.internal.Annotations;
                    
89 *   {@literal @}Before public void setUp() {
                    
90 *     Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
                    
91 *   }
                    
                
TestAMWebServicesJobConf.java https://gitlab.com/xiaoliuliu2050/hadoop | Java | 275 lines
                    
65import com.google.common.collect.Maps;
                    
66import com.google.inject.Guice;
                    
67import com.google.inject.Injector;
                    
67import com.google.inject.Injector;
                    
68import com.google.inject.servlet.GuiceServletContextListener;
                    
69import com.google.inject.servlet.ServletModule;
                    
71import com.sun.jersey.api.client.WebResource;
                    
72import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
                    
73import com.sun.jersey.test.framework.JerseyTest;
                    
89
                    
90  private Injector injector = Guice.createInjector(new ServletModule() {
                    
91    @Override
                    
128
                    
129  public class GuiceServletConfig extends GuiceServletContextListener {
                    
130
                    
                
EnsureJpaCanTakeObjectsInPropertiesTest.java https://gitlab.com/metamorphiccode/guice | Java | 110 lines
                    
14
                    
15package com.google.inject.persist.jpa;
                    
16
                    
17import com.google.inject.AbstractModule;
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.persist.PersistService;
                    
21import com.google.inject.persist.UnitOfWork;
                    
90
                    
91    injector = Guice.createInjector(new DBModule(dataSource, passDataSource));
                    
92
                    
                
Guice2TestPlugin.java http://mycila.googlecode.com/svn/ | Java | 178 lines
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Inject;
                    
29import com.google.inject.binder.LinkedBindingBuilder;
                    
30import com.google.inject.binder.ScopedBindingBuilder;
                    
31import com.google.inject.util.Modules;
                    
45 */
                    
46public final class Guice2TestPlugin extends DefaultTestPlugin {
                    
47
                    
52        context.attributes().set("guice.providers", new ArrayList<Provider<?>>());
                    
53        GuiceContext ctx = context.introspector().testClass().getAnnotation(GuiceContext.class);
                    
54
                    
77        // create injector
                    
78        Injector injector = Guice.createInjector(findStage(ctx), Modules.override(contextualModules(ctx)).with(modules));
                    
79        context.attributes().set(INJECTOR, injector);
                    
                
Initializer.java https://github.com/r3n/limewire5-ruby.git | Java | 645 lines
                    
53import com.google.inject.AbstractModule;
                    
54import com.google.inject.Guice;
                    
55import com.google.inject.Inject;
                    
55import com.google.inject.Inject;
                    
56import com.google.inject.Injector;
                    
57import com.google.inject.Provider;
                    
57import com.google.inject.Provider;
                    
58import com.google.inject.Stage;
                    
59import com.limegroup.gnutella.ActiveLimeWireCheck;
                    
368        stopwatch.reset();
                    
369        Injector injector = Guice.createInjector(Stage.PRODUCTION, new LimeWireModule(), new AbstractModule() {
                    
370            @Override
                    
                
VirtualGuestToNodeMetadataTest.java git://github.com/jclouds/jclouds.git | Java | 158 lines
                    
39
                    
40import com.google.common.base.Supplier;
                    
41import com.google.common.base.Suppliers;
                    
41import com.google.common.base.Suppliers;
                    
42import com.google.common.collect.ImmutableSet;
                    
43import com.google.common.collect.Iterables;
                    
44import com.google.common.collect.Sets;
                    
45import com.google.inject.Guice;
                    
46
                    
52
                    
53   VirtualGuestToImage virtualGuestToImage = Guice.createInjector().getInstance(VirtualGuestToImage.class);
                    
54   VirtualGuestToHardware virtualGuestToHardware = Guice.createInjector().getInstance(VirtualGuestToHardware.class);
                    
54   VirtualGuestToHardware virtualGuestToHardware = Guice.createInjector().getInstance(VirtualGuestToHardware.class);
                    
55   GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
                    
56
                    
                
GuiceServletConfig.java https://github.com/imyousuf/jersey.git | Java | 69 lines
                    
42
                    
43import com.google.inject.Guice;
                    
44import com.google.inject.Injector;
                    
44import com.google.inject.Injector;
                    
45import com.google.inject.servlet.GuiceServletContextListener;
                    
46import com.google.inject.servlet.ServletModule;
                    
46import com.google.inject.servlet.ServletModule;
                    
47import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
                    
48import com.sun.jersey.test.functional.guice.resources.PerRequestResource;
                    
53 */
                    
54public class GuiceServletConfig extends GuiceServletContextListener {
                    
55
                    
57    protected Injector getInjector() {
                    
58        return Guice.createInjector(new ServletModule() {
                    
59
                    
                
AWSIotDataModuleInjector.java https://gitlab.com/github-cloud-corp/aws-sdk-java | Java | 47 lines
                    
17import com.google.inject.AbstractModule;
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.Stage;
                    
21
                    
21
                    
22import cucumber.api.guice.CucumberModules;
                    
23import cucumber.runtime.java.guice.InjectorSource;
                    
35    public Injector getInjector() {
                    
36        return Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO,
                    
37                new AWSIotDataModule());
                    
                
AbstractXtextTests.java https://gitlab.com/inetaborigine/emqcfg | Java | 369 lines
                    
49
                    
50import com.google.inject.Guice;
                    
51import com.google.inject.Injector;
                    
107		assertTrue("super.setUp() has to be called before any injector is instantiated", canCreateInjector);
                    
108		injector = Guice.createInjector(modules);
                    
109	}
                    
123		if (injector == null)
                    
124			injector = Guice.createInjector();
                    
125		return injector.getInstance(clazz);
                    
129		if (injector == null)
                    
130			injector = Guice.createInjector();
                    
131		return injector.getInstance(key);
                    
135		if (injector == null)
                    
136			injector = Guice.createInjector();
                    
137		injector.injectMembers(object);
                    
                
GuiceExtensionFactory.java https://github.com/sonatype/sonatype-peaberry.git | Java | 204 lines
                    
18
                    
19import static com.google.inject.Guice.createInjector;
                    
20import static org.eclipse.core.runtime.ContributorFactoryOSGi.resolve;
                    
39
                    
40import com.google.inject.Injector;
                    
41import com.google.inject.Module;
                    
72 *         icon="icons/sample2.gif"
                    
73 *         class="org.ops4j.peaberry.eclipse.GuiceExtensionFactory:example.ViewImpl"
                    
74 *         id="example.view" /{@literal >}
                    
84 *         icon="icons/sample2.gif"
                    
85 *         class="org.ops4j.peaberry.eclipse.GuiceExtensionFactory"
                    
86 *         id="example.ViewImpl" /{@literal >}
                    
96 *         icon="icons/sample2.gif"
                    
97 *         class="org.ops4j.peaberry.eclipse.GuiceExtensionFactory:org.eclipse.ui.IViewPart"
                    
98 *         id="example.view" /{@literal >}
                    
                
Jsr330Test.java https://gitlab.com/metamorphiccode/guice | Java | 475 lines
                    
61  public void testInject() {
                    
62    Injector injector = Guice.createInjector(new AbstractModule() {
                    
63      protected void configure() {
                    
79  public void testQualifiedInject() {
                    
80    Injector injector = Guice.createInjector(new AbstractModule() {
                    
81      protected void configure() {
                    
97  public void testProviderInject() {
                    
98    Injector injector = Guice.createInjector(new AbstractModule() {
                    
99      protected void configure() {
                    
227  public void testInjectingMethodsWithNonVoidReturnTypes() {
                    
228    Guice.createInjector(new AbstractModule() {
                    
229      protected void configure() {
                    
296    
                    
297    Injector injector = Guice.createInjector(new AbstractModule() {
                    
298      @Override
                    
                
GuicePlanetProvider.java https://gitlab.com/essere.lab.public/qualitas.class-corpus | Java | 98 lines
                    
20
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Injector;
                    
39    /**
                    
40     * Instantiate a new GuicePlanetProvider using default guice module 
                    
41     * configured in PlanetConfig via 'guice.backend.module' property.
                    
52            Module module = (Module)moduleClass.newInstance();
                    
53            injector = Guice.createInjector(module);
                    
54        } catch (Throwable e) {                
                    
61    /**
                    
62     * Instantiate a new GuicePlanetProvider using the given Guice module.
                    
63     *
                    
74            Module module = (Module)moduleClass.newInstance();
                    
75            injector = Guice.createInjector(module);
                    
76        } catch (Throwable e) {                
                    
                
Struts2Factory.java https://gitlab.com/metamorphiccode/guice | Java | 231 lines
                    
16
                    
17package com.google.inject.struts2;
                    
18
                    
19import com.google.inject.AbstractModule;
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.Injector;
                    
39/**
                    
40 * Cleanup up version from Bob's GuiceObjectFactory. Now works properly with
                    
41 * GS2 and fixes several bugs.
                    
50  private static final String ERROR_NO_INJECTOR =
                    
51      "Cannot find a Guice injector.  Are you sure you registered a GuiceServletContextListener "
                    
52    + "that uses the Struts2GuicePluginModule in your application's web.xml?";
                    
53
                    
54  private static @com.google.inject.Inject Injector injector;
                    
55
                    
                
App.java https://gitlab.com/mfriedenhagen/ono-artifactory-shared | Java | 99 lines
                    
17
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
79        LOG.info("ARGS: {}", argList);
                    
80        Injector injector = Guice.createInjector(new ArtifactoryModule());
                    
81        App instance = injector.getInstance(App.class);
                    
                
Main.java https://gitlab.com/simon-erni/mobsys-manet | Java | 99 lines
                    
4import ch.hslu.mobsys.manet.protocol.SendService;
                    
5import com.google.common.util.concurrent.ServiceManager;
                    
6import com.google.inject.Injector;
                    
15
                    
16import static com.google.inject.Guice.createInjector;
                    
17
                    
25    public static void main(String[] args) throws Exception {
                    
26        Injector injector = createInjector(new ManetModule());
                    
27
                    
                
GuiceServletConfig.java https://github.com/arohner/jclouds.git | Java | 117 lines
                    
40import com.google.common.io.Closeables;
                    
41import com.google.inject.Guice;
                    
42import com.google.inject.Injector;
                    
42import com.google.inject.Injector;
                    
43import com.google.inject.Module;
                    
44import com.google.inject.TypeLiteral;
                    
44import com.google.inject.TypeLiteral;
                    
45import com.google.inject.servlet.GuiceServletContextListener;
                    
46import com.google.inject.servlet.ServletModule;
                    
52 */
                    
53public class GuiceServletConfig extends GuiceServletContextListener {
                    
54
                    
91   protected Injector getInjector() {
                    
92      return Guice.createInjector(new ServletModule() {
                    
93         @Override
                    
                
AWSSupportModuleInjector.java https://gitlab.com/github-cloud-corp/aws-sdk-java | Java | 47 lines
                    
17import com.google.inject.AbstractModule;
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.Stage;
                    
21
                    
21
                    
22import cucumber.api.guice.CucumberModules;
                    
23import cucumber.runtime.java.guice.InjectorSource;
                    
35    public Injector getInjector() {
                    
36        return Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO,
                    
37                new AWSSupportModule());
                    
                
PropertyListenerTest.java https://github.com/jglick/sisu.git | Java | 205 lines
                    
11 *******************************************************************************/
                    
12package org.sonatype.guice.bean.inject;
                    
13
                    
15
                    
16import org.sonatype.guice.bean.reflect.BeanProperty;
                    
17
                    
17
                    
18import com.google.inject.AbstractModule;
                    
19import com.google.inject.ConfigurationException;
                    
19import com.google.inject.ConfigurationException;
                    
20import com.google.inject.Guice;
                    
21import com.google.inject.Injector;
                    
128    {
                    
129        injector = Guice.createInjector( new AbstractModule()
                    
130        {
                    
                
RestletGuice.java git://github.com/restlet/restlet-framework-java.git | Java | 330 lines
                    
39import com.google.inject.AbstractModule;
                    
40import com.google.inject.Guice;
                    
41import com.google.inject.Inject;
                    
80                            injector = inj = Guice
                    
81                                    .createInjector(RestletGuice.Module.this);
                    
82                        }
                    
271     */
                    
272    public static Injector createInjector(com.google.inject.Module... modules) {
                    
273        return injectorFor(null, new Module(modules));
                    
324        if (stage == null) {
                    
325            return Guice.createInjector(rootModule);
                    
326        } else {
                    
326        } else {
                    
327            return Guice.createInjector(stage, rootModule);
                    
328        }
                    
                
TestAMWebServices.java https://gitlab.com/xiaoliuliu2050/hadoop | Java | 345 lines
                    
47import com.google.common.collect.Sets;
                    
48import com.google.inject.Guice;
                    
49import com.google.inject.Injector;
                    
49import com.google.inject.Injector;
                    
50import com.google.inject.servlet.GuiceServletContextListener;
                    
51import com.google.inject.servlet.ServletModule;
                    
55import com.sun.jersey.api.client.WebResource;
                    
56import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
                    
57import com.sun.jersey.test.framework.JerseyTest;
                    
71
                    
72  private Injector injector = Guice.createInjector(new ServletModule() {
                    
73    @Override
                    
88
                    
89  public class GuiceServletConfig extends GuiceServletContextListener {
                    
90
                    
                
ProvisionExceptionsTest.java https://gitlab.com/metamorphiccode/guice | Java | 178 lines
                    
35  public void testConstructorRuntimeException() {
                    
36    Injector injector = Guice.createInjector(new AbstractModule() {
                    
37      @Override
                    
57  public void testConstructorCheckedException() {
                    
58    Injector injector = Guice.createInjector(new AbstractModule() {
                    
59      @Override
                    
79  public void testCustomProvidersRuntimeException() {
                    
80    Injector injector = Guice.createInjector(new AbstractModule() {
                    
81      @Override
                    
104  public void testProviderMethodRuntimeException() {
                    
105    Injector injector = Guice.createInjector(new AbstractModule() {
                    
106      @Override
                    
127  public void testProviderMethodCheckedException() {
                    
128    Injector injector = Guice.createInjector(new AbstractModule() {
                    
129      @Override
                    
                
JsPlugin.java https://gitlab.com/chenfengxu/gerrit | Java | 110 lines
                    
14
                    
15package com.google.gerrit.server.plugins;
                    
16
                    
18import com.google.gerrit.extensions.annotations.PluginName;
                    
19import com.google.gerrit.extensions.registration.DynamicSet;
                    
20import com.google.gerrit.extensions.webui.JavaScriptPlugin;
                    
20import com.google.gerrit.extensions.webui.JavaScriptPlugin;
                    
21import com.google.gerrit.extensions.webui.WebUiPlugin;
                    
22import com.google.gerrit.lifecycle.LifecycleManager;
                    
24import com.google.inject.AbstractModule;
                    
25import com.google.inject.Guice;
                    
26import com.google.inject.Injector;
                    
55    String fileName = getSrcFile().getFileName().toString();
                    
56    sysInjector = Guice.createInjector(new StandaloneJsPluginModule(getName(), fileName));
                    
57    manager.start();
                    
                
AtrsServer.java https://gitlab.com/devsathish/atrs | Java | 91 lines
                    
7import com.cyngn.vertx.web.RouterTools;
                    
8import com.google.inject.Guice;
                    
9import com.google.inject.Inject;
                    
55        module = new AtrsModule(vertx, config, onReady -> {
                    
56            // Create Guice injector and initialize this Verticle instance.
                    
57
                    
57
                    
58            Guice.createInjector(module).injectMembers(this);
                    
59            RouterTools.registerRootHandlers(router, bodyHandler);
                    
                
OrgHandlerTest.java https://github.com/arohner/jclouds.git | Java | 126 lines
                    
40import com.google.common.collect.ImmutableSet;
                    
41import com.google.inject.Guice;
                    
42import com.google.inject.Injector;
                    
54
                    
55      Injector injector = Guice.createInjector(new SaxParserModule());
                    
56      Factory factory = injector.getInstance(ParseSax.Factory.class);
                    
79
                    
80      Injector injector = Guice.createInjector(new SaxParserModule());
                    
81      Factory factory = injector.getInstance(ParseSax.Factory.class);
                    
98      InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
                    
99      Injector injector = Guice.createInjector(new SaxParserModule());
                    
100      Factory factory = injector.getInstance(ParseSax.Factory.class);
                    
115      InputStream is = getClass().getResourceAsStream("/org-savvis.xml");
                    
116      Injector injector = Guice.createInjector(new SaxParserModule());
                    
117      Factory factory = injector.getInstance(ParseSax.Factory.class);
                    
                
LoadGenerator.java https://gitlab.com/mayakarya/swift | Java | 171 lines
                    
22import com.facebook.nifty.client.UnframedClientConnector;
                    
23import com.facebook.swift.codec.guice.ThriftCodecModule;
                    
24import com.facebook.swift.service.ThriftClientManager;
                    
24import com.facebook.swift.service.ThriftClientManager;
                    
25import com.facebook.swift.service.guice.ThriftClientModule;
                    
26import com.facebook.swift.service.guice.ThriftClientStatsModule;
                    
26import com.facebook.swift.service.guice.ThriftClientStatsModule;
                    
27import com.google.common.collect.ImmutableMap;
                    
28import com.google.common.net.HostAndPort;
                    
28import com.google.common.net.HostAndPort;
                    
29import com.google.inject.*;
                    
30import io.airlift.bootstrap.LifeCycleManager;
                    
62        } else {
                    
63            injector = Guice.createInjector(
                    
64                    Stage.PRODUCTION,
                    
                
ParseCookbookDefinitionListFromJsonv10Test.java https://github.com/jclouds/legacy-jclouds-chef.git | Java | 85 lines
                    
35
                    
36import com.google.common.collect.ImmutableSet;
                    
37import com.google.inject.AbstractModule;
                    
37import com.google.inject.AbstractModule;
                    
38import com.google.inject.Guice;
                    
39import com.google.inject.Injector;
                    
47   protected void setUpInjector() throws IOException {
                    
48      Injector injector = Guice.createInjector(new AbstractModule() {
                    
49         @Override
                    
                
Guice2TestPlugin.java http://mycila.googlecode.com/svn/ | Java | 175 lines
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Inject;
                    
23import com.google.inject.Injector;
                    
24import com.google.inject.Module;
                    
25import com.google.inject.Provider;
                    
45 */
                    
46public final class Guice2TestPlugin extends AbstractTestPlugin {
                    
47
                    
49        context.setAttribute("guice.providers", new ArrayList<Provider<?>>());
                    
50        GuiceContext ctx = context.getTest().getTargetClass().getAnnotation(GuiceContext.class);
                    
51
                    
74        // create injector
                    
75        Injector injector = Guice.createInjector(findStage(ctx), Modules.override(contextualModules(ctx)).with(modules));
                    
76        context.setAttribute("com.google.inject.Injector", injector);
                    
                
ToIteratorOfListPageExpectTest.java git://github.com/jclouds/jclouds.git | Java | 184 lines
                    
27import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
                    
28import org.jclouds.googlecomputeengine.config.GoogleComputeEngineParserModule;
                    
29import org.jclouds.googlecomputeengine.domain.Address;
                    
30import org.jclouds.googlecomputeengine.domain.Image;
                    
31import org.jclouds.googlecomputeengine.domain.Instance;
                    
32import org.jclouds.googlecomputeengine.features.AddressApi;
                    
44import com.google.common.collect.ImmutableList;
                    
45import com.google.inject.Guice;
                    
46
                    
47@Test(groups = "unit", testName = "ToIteratorOfListPageTest")
                    
48public class ToIteratorOfListPageExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
                    
49
                    
49
                    
50   private final Json json = Guice.createInjector(new GsonModule(), new GoogleComputeEngineParserModule())
                    
51         .getInstance(Json.class);
                    
                
TudeyTool.java git://github.com/threerings/clyde.git | Java | 252 lines
                    
5// Copyright (C) 2005-2012 Three Rings Design, Inc.
                    
6// http://code.google.com/p/clyde/
                    
7//
                    
27
                    
28import com.google.inject.Guice;
                    
29import com.google.inject.Injector;
                    
157        // create the tool server
                    
158        Injector injector = Guice.createInjector(new ToolServer.ToolModule(_client));
                    
159        _server = injector.getInstance(ToolServer.class);
                    
                
TransactionalInterceptorTest.java https://github.com/frodooooo39/smart-cms.git | Java | 288 lines
                    
3import com.google.inject.AbstractModule;
                    
4import com.google.inject.Guice;
                    
5import com.google.inject.Injector;
                    
83    mockManager = mockery.mock(TransactionManager.class);
                    
84    injector = Guice.createInjector(new AbstractModule() {
                    
85
                    
                
ModulesTest.java https://gitlab.com/metamorphiccode/guice | Java | 80 lines
                    
1/**
                    
2 * Copyright (C) 2008 Google Inc.
                    
3 *
                    
16
                    
17package com.google.inject;
                    
18
                    
33    Module combined = Modules.combine(newModule(1), newModule(2L), newModule((short) 3));
                    
34    Injector injector = Guice.createInjector(combined);
                    
35    assertEquals(1, injector.getInstance(Integer.class).intValue());
                    
41    Iterable<Module> modules = Arrays.asList(newModule(1), newModule(2L), newModule((short) 3));
                    
42    Injector injector = Guice.createInjector(Modules.combine(modules));
                    
43    assertEquals(1, injector.getInstance(Integer.class).intValue());
                    
60    final Module combined2 = Modules.combine(skipSourcesModule);
                    
61    Injector injector = Guice.createInjector(combined2);
                    
62    ElementSource source = (ElementSource) injector.getBinding(Integer.class).getSource();
                    
                
GuiceObjectFactory.java https://gitlab.com/metamorphiccode/guice | Java | 247 lines
                    
18
                    
19import com.google.inject.AbstractModule;
                    
20import com.google.inject.Binder;
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Injector;
                    
24import com.google.inject.internal.Annotations;
                    
25import com.google.inject.servlet.ServletModule;
                    
26
                    
42/**
                    
43 * @deprecated Use {@link com.google.inject.struts2.Struts2Factory} instead.
                    
44 */
                    
124      logger.info("Creating injector...");
                    
125      this.injector = Guice.createInjector(new AbstractModule() {
                    
126        protected void configure() {
                    
                
TestUtils.java https://gitlab.com/kidaa/lantern.git | Java | 411 lines
                    
19import org.lantern.http.JettyLauncher;
                    
20import org.lantern.oauth.LanternGoogleOAuth2Credentials;
                    
21import org.lantern.privacy.EncryptedFileService;
                    
39import com.google.inject.Binder;
                    
40import com.google.inject.Guice;
                    
41import com.google.inject.Inject;
                    
142
                    
143        injector = Guice.createInjector(lm);
                    
144        
                    
269        IOException {
                    
270        final LanternGoogleOAuth2Credentials creds = getGoogleOauthCreds();
                    
271        final int attempts = 2;
                    
278    
                    
279    public static LanternGoogleOAuth2Credentials getGoogleOauthCreds() {
                    
280        return new LanternGoogleOAuth2Credentials("anon@getlantern.org",
                    
                
NetworkConnectionSectionHandlerTest.java https://github.com/arohner/jclouds.git | Java | 65 lines
                    
34import com.google.common.collect.Iterables;
                    
35import com.google.inject.Guice;
                    
36import com.google.inject.Injector;
                    
46      InputStream is = getClass().getResourceAsStream("/networkconnectionsection.xml");
                    
47      Injector injector = Guice.createInjector(new SaxParserModule());
                    
48      Factory factory = injector.getInstance(ParseSax.Factory.class);
                    
                
NestSlashKeysTest.java https://github.com/jclouds/legacy-jclouds-chef.git | Java | 121 lines
                    
33
                    
34import com.google.common.base.Supplier;
                    
35import com.google.common.base.Suppliers;
                    
35import com.google.common.base.Suppliers;
                    
36import com.google.common.collect.ImmutableMultimap;
                    
37import com.google.inject.AbstractModule;
                    
37import com.google.inject.AbstractModule;
                    
38import com.google.inject.Guice;
                    
39import com.google.inject.Injector;
                    
53   protected void setUpInjector() throws IOException {
                    
54      Injector injector = Guice.createInjector(new AbstractModule() {
                    
55         @Override
                    
                
ManualLocalTransactionsConfidenceTest.java https://gitlab.com/metamorphiccode/guice | Java | 95 lines
                    
1/**
                    
2 * Copyright (C) 2010 Google, Inc.
                    
3 *
                    
16
                    
17package com.google.inject.persist.jpa;
                    
18
                    
18
                    
19import com.google.inject.Guice;
                    
20import com.google.inject.Inject;
                    
20import com.google.inject.Inject;
                    
21import com.google.inject.Injector;
                    
22import com.google.inject.persist.PersistService;
                    
43  public void setUp() {
                    
44    injector = Guice.createInjector(new JpaPersistModule("testUnit"));
                    
45
                    
                
ServerToNodeMetadataTest.java git://github.com/jclouds/jclouds.git | Java | 204 lines
                    
54
                    
55import com.google.common.base.Supplier;
                    
56import com.google.common.collect.ImmutableList;
                    
56import com.google.common.collect.ImmutableList;
                    
57import com.google.common.collect.ImmutableSet;
                    
58import com.google.inject.AbstractModule;
                    
58import com.google.inject.AbstractModule;
                    
59import com.google.inject.Guice;
                    
60import com.google.inject.name.Names;
                    
89
                    
90      GroupNamingConvention.Factory namingConvention = Guice.createInjector(new AbstractModule() {
                    
91         @Override
                    
                
TestMonitoringGuiceInterceptor.java https://gitlab.com/tuandung.bui/javamelody | Java | 117 lines
                    
26import com.google.inject.AbstractModule;
                    
27import com.google.inject.Guice;
                    
28import com.google.inject.Injector;
                    
53	public void testNewInstance() {
                    
54		assertNotNull("new MonitoringGuiceInterceptor", new MonitoringGuiceInterceptor());
                    
55	}
                    
59	public void testGetGuiceCounter() {
                    
60		assertNotNull("getGuiceCounter", MonitoringProxy.getGuiceCounter());
                    
61	}
                    
65	public void testGuiceAOP() {
                    
66		final Counter guiceCounter = MonitoringProxy.getGuiceCounter();
                    
67		guiceCounter.clear();
                    
85		};
                    
86		final Injector injector = Guice.createInjector(testModule);
                    
87		final SpringTestFacade springTestFacade = injector.getInstance(SpringTestFacade.class);
                    
                
App.java https://gitlab.com/akkhil2012/java-design-patterns | Java | 67 lines
                    
24
                    
25import com.google.inject.Guice;
                    
26import com.google.inject.Injector;
                    
43 * <p>
                    
44 * The third example takes the pattern a step further. It uses Guice framework for Dependency
                    
45 * Injection. {@link TobaccoModule} binds a concrete implementation to abstraction. Injector is then
                    
45 * Injection. {@link TobaccoModule} binds a concrete implementation to abstraction. Injector is then
                    
46 * used to create {@link GuiceWizard} object with correct dependencies.
                    
47 *
                    
63    Injector injector = Guice.createInjector(new TobaccoModule());
                    
64    GuiceWizard guiceWizard = injector.getInstance(GuiceWizard.class);
                    
65    guiceWizard.smoke();
                    
                
AbstractTestDiscoveryModule.java https://gitlab.com/CORP-RESELLER/airlift | Java | 118 lines
                    
17
                    
18import com.google.common.collect.ImmutableMap;
                    
19import com.google.inject.Binder;
                    
19import com.google.inject.Binder;
                    
20import com.google.inject.Guice;
                    
21import com.google.inject.Injector;
                    
21import com.google.inject.Injector;
                    
22import com.google.inject.Key;
                    
23import com.google.inject.Module;
                    
53    {
                    
54        Injector injector = Guice.createInjector(
                    
55                new ConfigurationModule(new ConfigurationFactory(ImmutableMap.of("discovery.uri", "fake://server"))),
                    
83
                    
84        Injector injector = Guice.createInjector(
                    
85                new ConfigurationModule(new ConfigurationFactory(config)),
                    
                
PrologTestCase.java https://gitlab.com/chenfengxu/gerrit | Java | 189 lines
                    
14
                    
15package com.google.gerrit.server.rules;
                    
16
                    
17import static com.google.common.truth.Truth.assertThat;
                    
18import static com.google.common.truth.Truth.assertWithMessage;
                    
19import static java.nio.charset.StandardCharsets.UTF_8;
                    
22import com.google.gerrit.testing.GerritBaseTests;
                    
23import com.google.inject.Guice;
                    
24import com.google.inject.Module;
                    
25import com.googlecode.prolog_cafe.exceptions.CompileException;
                    
26import com.googlecode.prolog_cafe.lang.BufferingPrologControl;
                    
27import com.googlecode.prolog_cafe.lang.JavaObjectTerm;
                    
63
                    
64    envFactory = Guice.createInjector(moduleList).getInstance(PrologEnvironment.Factory.class);
                    
65    PrologEnvironment env = envFactory.create(newMachine());
                    
                
GuiceFactoryTest.java https://gitlab.com/chiavegatto/cucumber-jvm | Java | 199 lines
                    
41    public void factoryCanBeIntantiatedWithArgConstructor() {
                    
42        factory = new GuiceFactory(Guice.createInjector());
                    
43        assertThat(factory, notNullValue());
                    
47    public void factoryStartFailsIfScenarioScopeIsNotBound() {
                    
48        factory = new GuiceFactory(Guice.createInjector());
                    
49        try {
                    
61    public void shouldGiveNewInstancesOfUnscopedClassWithinAScenario() {
                    
62        factory = new GuiceFactory(injector(CucumberModules.SCENARIO));
                    
63        instancesFromSameScenario = getInstancesFromSameScenario(factory, UnscopedClass.class);
                    
77    public void shouldGiveTheSameInstanceOfAnnotatedScenarioScopedClassWithinAScenario() {
                    
78        factory = new GuiceFactory(injector(CucumberModules.SCENARIO));
                    
79        instancesFromSameScenario = getInstancesFromSameScenario(factory, AnnotatedScenarioScopedClass.class);
                    
162    private Injector injector(Module... module) {
                    
163        return Guice.createInjector(Stage.PRODUCTION, module);
                    
164    }
                    
                
FriendBrowseDownloadRUDPTest.java https://github.com/r3n/limewire5-ruby.git | Java | 294 lines
                    
46
                    
47import com.google.inject.Guice;
                    
48import com.google.inject.Injector;
                    
48import com.google.inject.Injector;
                    
49import com.google.inject.Key;
                    
50import com.google.inject.Module;
                    
50import com.google.inject.Module;
                    
51import com.google.inject.Stage;
                    
52import com.google.inject.TypeLiteral;
                    
83    protected void setUp() throws Exception {
                    
84        injector = createInjector(getModules());
                    
85        registry = injector.getInstance(ServiceRegistry.class);
                    
101    private Injector createInjector(Module... modules) {
                    
102        return Guice.createInjector(Stage.PRODUCTION, modules);
                    
103    }
                    
                
AmazonElasticLoadBalancingModuleInjector.java https://gitlab.com/github-cloud-corp/aws-sdk-java | Java | 48 lines
                    
17import com.google.inject.AbstractModule;
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.Stage;
                    
21
                    
21
                    
22import cucumber.api.guice.CucumberModules;
                    
23import cucumber.runtime.java.guice.InjectorSource;
                    
35    public Injector getInjector() {
                    
36        return Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO,
                    
37                new AmazonElasticLoadBalancingModule());
                    
                
AWSApplicationAutoScalingModuleInjector.java https://gitlab.com/github-cloud-corp/aws-sdk-java | Java | 48 lines
                    
17import com.google.inject.AbstractModule;
                    
18import com.google.inject.Guice;
                    
19import com.google.inject.Injector;
                    
19import com.google.inject.Injector;
                    
20import com.google.inject.Stage;
                    
21
                    
21
                    
22import cucumber.api.guice.CucumberModules;
                    
23import cucumber.runtime.java.guice.InjectorSource;
                    
35    public Injector getInjector() {
                    
36        return Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO,
                    
37                new AWSApplicationAutoScalingModule());
                    
                
FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeatTest.java git://github.com/jclouds/jclouds.git | Java | 176 lines
                    
28
                    
29import com.google.common.base.Supplier;
                    
30import com.google.common.base.Suppliers;
                    
31import com.google.inject.AbstractModule;
                    
32import com.google.inject.Guice;
                    
33import com.google.inject.TypeLiteral;
                    
105   public void testPropertyChangesDelimiter() {
                    
106      GroupNamingConvention fn = Guice.createInjector(new AbstractModule() {
                    
107
                    
120   public void testPropertyChangesPrefix() {
                    
121      GroupNamingConvention fn = Guice.createInjector(new AbstractModule() {
                    
122
                    
136   public void testCanChangeSuffixSupplier() {
                    
137      GroupNamingConvention fn = Guice.createInjector(new AbstractModule() {
                    
138
                    
                
OhaiModuleTest.java https://github.com/jclouds/legacy-jclouds-chef.git | Java | 118 lines
                    
44import com.google.common.base.Supplier;
                    
45import com.google.inject.Guice;
                    
46import com.google.inject.Injector;
                    
46import com.google.inject.Injector;
                    
47import com.google.inject.Provides;
                    
48import com.google.inject.TypeLiteral;
                    
80
                    
81      Injector injector = Guice.createInjector(new ChefParserModule(), new GsonModule(), new WebXmlOhaiModule(),
                    
82            new ServletOhaiModule(), new OhaiModule() {
                    
                
ContextPathTest.java https://gitlab.com/metamorphiccode/guice | Java | 293 lines
                    
21
                    
22import com.google.inject.Guice;
                    
23import com.google.inject.Inject;
                    
23import com.google.inject.Inject;
                    
24import com.google.inject.Injector;
                    
25import com.google.inject.Key;
                    
58  private FilterConfig filterConfig;
                    
59  private GuiceFilter guiceFilter;
                    
60
                    
62  public final void setUp() throws Exception {
                    
63    injector = Guice.createInjector(new ServletModule() {
                    
64      @Override
                    
90
                    
91    guiceFilter = new GuiceFilter();
                    
92    guiceFilter.init(filterConfig);
                    
                
DeclarativeTransactionTest.java https://github.com/frodooooo39/smart-cms.git | Java | 100 lines
                    
3import com.google.inject.AbstractModule;
                    
4import com.google.inject.Guice;
                    
5import com.google.inject.Inject;
                    
5import com.google.inject.Inject;
                    
6import com.google.inject.Injector;
                    
7import com.google.inject.TypeLiteral;
                    
50    writeDao = mockery.mock(CommonWriteDao.class);
                    
51    injector = Guice.createInjector(new DemoDomainMasterModule(new AbstractModule() {
                    
52
                    
                
Guice1TestPlugin.java http://mycila.googlecode.com/svn/ | Java | 175 lines
                    
20import com.google.inject.Binder;
                    
21import com.google.inject.Guice;
                    
22import com.google.inject.Inject;
                    
22import com.google.inject.Inject;
                    
23import com.google.inject.Injector;
                    
24import com.google.inject.Module;
                    
29import com.google.inject.binder.LinkedBindingBuilder;
                    
30import com.google.inject.binder.ScopedBindingBuilder;
                    
31import com.mycila.testing.core.AbstractTestPlugin;
                    
48        context.setAttribute("guice.providers", new ArrayList<Provider<?>>());
                    
49        GuiceContext ctx = context.getTest().getTargetClass().getAnnotation(GuiceContext.class);
                    
50
                    
74        // create injector
                    
75        Injector injector = Guice.createInjector(findStage(ctx), modules);
                    
76        context.setAttribute("com.google.inject.Injector", injector);
                    
                
ServletContextInfoSupplierTest.java https://github.com/jclouds/legacy-jclouds-chef.git | Java | 162 lines
                    
36
                    
37import com.google.inject.Guice;
                    
38import com.google.inject.Injector;
                    
38import com.google.inject.Injector;
                    
39import com.google.inject.Provides;
                    
40
                    
63
                    
64		Injector injector = Guice.createInjector(new GsonModule(),
                    
65				new ServletOhaiModule() {
                    
101
                    
102		Injector injector = Guice.createInjector(new GsonModule(),
                    
103				new ServletOhaiModule() {
                    
139
                    
140		Injector injector = Guice.createInjector(new GsonModule(),
                    
141				new ServletOhaiModule() {
                    
                
OSGiActivator.java https://github.com/gatherdata/gather-data.git | Java | 54 lines
                    
18
                    
19import com.google.inject.Inject;
                    
20
                    
20
                    
21import static com.google.inject.Guice.createInjector;
                    
22import static org.ops4j.peaberry.Peaberry.osgiModule;
                    
38    {
                    
39        createInjector(osgiModule(bc), new GuiceBindingModule()).injectMembers(this);
                    
40
                    
                
OSGiActivator.java https://github.com/gatherdata/gather-archiver.git | Java | 56 lines
                    
9
                    
10import static com.google.inject.Guice.createInjector;
                    
11import static org.ops4j.peaberry.Peaberry.osgiModule;
                    
21
                    
22import com.google.inject.Inject;
                    
23
                    
42
                    
43        createInjector(osgiModule(bc), new GuiceBindingModule()).injectMembers(this);
                    
44
                    
                
OhaiModuleTest.java https://github.com/jclouds/legacy-jclouds-chef.git | Java | 151 lines
                    
39
                    
40import com.google.common.base.Supplier;
                    
41import com.google.common.base.Suppliers;
                    
42import com.google.inject.AbstractModule;
                    
43import com.google.inject.Guice;
                    
44import com.google.inject.Injector;
                    
44import com.google.inject.Injector;
                    
45import com.google.inject.TypeLiteral;
                    
46import com.google.inject.util.Providers;
                    
64
                    
65      Injector injector = Guice.createInjector(new AbstractModule() {
                    
66         @Override
                    
98
                    
99      Injector injector = Guice.createInjector(new AbstractModule() {
                    
100         @Override
                    
                
SchemaUpdater.java https://gitlab.com/chenfengxu/gerrit | Java | 153 lines
                    
19import com.google.gerrit.reviewdb.client.SystemConfig;
                    
20import com.google.gerrit.reviewdb.server.ReviewDb;
                    
21import com.google.gerrit.reviewdb.server.ReviewDbUtil;
                    
21import com.google.gerrit.reviewdb.server.ReviewDbUtil;
                    
22import com.google.gerrit.server.GerritPersonIdent;
                    
23import com.google.gerrit.server.config.AllProjectsName;
                    
27import com.google.gerrit.server.config.SitePaths;
                    
28import com.google.gerrit.server.git.GitRepositoryManager;
                    
29import com.google.gerrit.server.group.SystemGroupBackend;
                    
32import com.google.inject.AbstractModule;
                    
33import com.google.inject.Guice;
                    
34import com.google.inject.Inject;
                    
68    // are behind this installation's current version.
                    
69    return Guice.createInjector(
                    
70        Stage.DEVELOPMENT,
                    
                
AbstractInjectorGrapherTest.java https://gitlab.com/metamorphiccode/guice | Java | 184 lines
                    
21import com.google.common.collect.Sets;
                    
22import com.google.inject.AbstractModule;
                    
23import com.google.inject.BindingAnnotation;
                    
23import com.google.inject.BindingAnnotation;
                    
24import com.google.inject.Guice;
                    
25import com.google.inject.Inject;
                    
123  public void testLinkedAndInstanceBindings() throws Exception {
                    
124    grapher.graph(Guice.createInjector(new AbstractModule() {
                    
125        @Override protected void configure() {
                    
145    final Wrapper<Provider<A2>> wrapper = new Wrapper<Provider<A2>>();
                    
146    grapher.graph(Guice.createInjector(new AbstractModule() {
                    
147        @Override protected void configure() {
                    
169  public void testGraphWithGivenRoot() throws Exception {
                    
170    grapher.graph(Guice.createInjector(new AbstractModule() {
                    
171        @Override protected void configure() {
                    
                
ParseCookbookVersionFromJsonTest.java git://github.com/jclouds/jclouds.git | Java | 133 lines
                    
18
                    
19import static com.google.common.io.BaseEncoding.base16;
                    
20import static org.testng.Assert.assertEquals;
                    
39import com.google.inject.AbstractModule;
                    
40import com.google.inject.Guice;
                    
41import com.google.inject.Injector;
                    
41import com.google.inject.Injector;
                    
42import com.google.inject.Key;
                    
43import com.google.inject.TypeLiteral;
                    
56   protected void setUpInjector() throws IOException {
                    
57      injector = Guice.createInjector(new AbstractModule() {
                    
58         @Override
                    
                
NameUsageIndexer.java http://gbif-ecat.googlecode.com/svn/trunk/ | Java | 191 lines
                    
9
                    
10import com.google.inject.Guice;
                    
11import com.google.inject.Inject;
                    
11import com.google.inject.Inject;
                    
12import com.google.inject.Injector;
                    
13import com.google.inject.name.Named;
                    
81    // Creates the injector
                    
82    Injector injector = Guice.createInjector(new IndexingModule(args[0]));
                    
83    // Gets the indexer instance
                    
181      super.shutdownService(tasksCount);
                    
182      // This statement is used because the Guice container is not stopped inside the threadpool.
                    
183      System.exit(0);
                    
                
GerritServerConfigModule.java https://gitlab.com/chenfengxu/gerrit | Java | 82 lines
                    
14
                    
15package com.google.gerrit.server.config;
                    
16
                    
16
                    
17import static com.google.inject.Scopes.SINGLETON;
                    
18
                    
18
                    
19import com.google.gerrit.server.securestore.DefaultSecureStore;
                    
20import com.google.gerrit.server.securestore.SecureStore;
                    
22import com.google.inject.AbstractModule;
                    
23import com.google.inject.Guice;
                    
24import com.google.inject.Injector;
                    
52        };
                    
53    Injector injector = Guice.createInjector(m);
                    
54    SitePaths site = injector.getInstance(SitePaths.class);
                    
                
 

Source

Language