Package com.google.inject

Examples of com.google.inject.AbstractModule


    @Test
    public void shouldNotCreateAnyNonEagerSingletons_Development_NoChild() {
        Injector injector = LifecycleInjector.builder()
                .inStage(Stage.DEVELOPMENT)
                .withMode(LifecycleInjectorMode.SIMULATED_CHILD_INJECTORS)
                .withModules(new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(ThisShouldBeEager.class);
                    }
                })
View Full Code Here


    @Test
    public void shouldPostCreateAllBoundNonTransitiveSingletons_Development_NoChild() {
        Injector injector = LifecycleInjector.builder()
                .inStage(Stage.DEVELOPMENT)
                .withMode(LifecycleInjectorMode.SIMULATED_CHILD_INJECTORS)
                .withModules(new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(ThisShouldBeEager.class);
                    }
                })
View Full Code Here

        Stopwatch sw = new Stopwatch().start();
       
        final TerminationEvent event = new SelfDestructingTerminationEvent(1, TimeUnit.SECONDS);
        LifecycleInjector.builder()
            // Example of a singleton that will be created
            .withAdditionalModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SomeSingleton.class).asEagerSingleton();
                }
            })
View Full Code Here

   
    public static void main(String args[]) {
        final TerminationEvent event = new SelfDestructingTerminationEvent(1, TimeUnit.SECONDS);
        LifecycleInjector.builder()
            // Example of a singleton that will be created
            .withAdditionalModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SomeSingleton.class).asEagerSingleton();
                }
            })
View Full Code Here

    }
   
    @Test
    public void shouldInstallAbstractModuleInstance() throws Exception {
        List<Module> modules = new ModuleListBuilder()
            .include(new AbstractModule() {
                @Override
                protected void configure() {
                }
            })
            .build(Guice.createInjector());
View Full Code Here

    }
   
    @Test
    public void shouldNotExcludeAbstractModuleInstance() throws Exception {
        List<Module> modules = new ModuleListBuilder()
            .include(new AbstractModule() {
                @Override
                protected void configure() {
                }
            })
            .exclude(AbstractModule.class)
View Full Code Here

        LifecycleInjector.builder()
            .inStage(Stage.DEVELOPMENT)
            .withMode(LifecycleInjectorMode.SIMULATED_CHILD_INJECTORS)
            .withPostInjectorAction(new BindingReport(testName))
            .withPostInjectorAction(new CreateAllBoundSingletons())
            .withModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(FooImpl.class);
                }
            })
View Full Code Here

        LifecycleInjector.builder()
            .withPostInjectorAction(new BindingReport(testName))
            .withPostInjectorAction(new CreateAllBoundSingletons())
            .inStage(Stage.DEVELOPMENT)
            .withMode(LifecycleInjectorMode.SIMULATED_CHILD_INJECTORS)
            .withModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Foo.class).to(FooImpl.class);
                }
            })
View Full Code Here

    @Test
    public void testInterfaceSingletonProductionStage() {
        LifecycleInjector.builder()
            .withPostInjectorAction(new BindingReport(testName))
            .withPostInjectorAction(new CreateAllBoundSingletons())
            .withModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Foo.class).to(FooImpl.class);
                }
            })
View Full Code Here

        LifecycleInjector.builder()
            .withPostInjectorAction(new BindingReport(testName))
            .withPostInjectorAction(new CreateAllBoundSingletons())
            .inStage(Stage.DEVELOPMENT)
            .withMode(LifecycleInjectorMode.SIMULATED_CHILD_INJECTORS)
            .withModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Foo.class).to(FooNotAnnotated.class).in(Scopes.SINGLETON);
                }
            })
View Full Code Here

TOP

Related Classes of com.google.inject.AbstractModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.