Package com.google.inject

Examples of com.google.inject.AbstractModule


    }
   
    public static class FooSuite implements BootstrapModule {
        @Override
        public void configure(BootstrapBinder binder) {
            binder.include(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Foo.class).to(FooImpl.class);
                }
            });
View Full Code Here


      SuiteBootstrap(Suite1 suite1) {
        this.suite1 = suite1;
      }
    @Override
    public void configure(LifecycleInjectorBuilder builder) {
      builder.withAdditionalModules(new AbstractModule() {
        @Override
        protected void configure() {
          bind(String.class).annotatedWith(Names.named("suite1")).toInstance(suite1.name());
        }
      });
View Full Code Here

        }

        @Override
        public void configure(BootstrapBinder binder) {
            binder.bindPostInjectorAction().toInstance(new TestAction(getClass().getSimpleName()));
            binder.include(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(String.class).annotatedWith(Names.named("application")).toInstance(application.name());
                }
            });
View Full Code Here

    @Test
    public void     testSimpleProvider() throws Exception
    {
        Injector                injector = Guice.createInjector
        (
            new AbstractModule()
            {
                @Override
                protected void configure()
                {
                    ProviderBinderUtil.bind(binder(), SimpleProvider.class, Scopes.SINGLETON);
View Full Code Here

    }

    @Test
    public void     testDeadLock() throws InterruptedException
    {
        AbstractModule      module = new AbstractModule()
        {
            @Override
            protected void configure()
            {
                binder().bindScope(LazySingleton.class, LazySingletonScope.get());
View Full Code Here

                    @Override
                    public void configure(BootstrapBinder binder) {
                        binder.bindLifecycleListener().to(LoggingLifecycleListener.class);
                    }
                })
                .withModules(new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(IParent.class).to(Parent.class);
                        bind(Parent.class).toProvider(ConcurrentProviders.of(Parent.class));
                    }
View Full Code Here

    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
    @Test(dataProvider = "builders")
    public void testErrors(LifecycleInjectorBuilder lifecycleInjectorBuilder) throws Exception
    {
        AbstractModule module = new AbstractModule()
        {
            @Override
            protected void configure()
            {
                binder().bind(WarmUpWithException.class).asEagerSingleton();
View Full Code Here

    @Test(dataProvider = "builders")
    public void testDag1MultiModule(LifecycleInjectorBuilder lifecycleInjectorBuilder) throws Exception
    {
        final List<AbstractModule> modules = Arrays.asList(
            new AbstractModule()
            {
                @Override
                protected void configure()
                {
                    bind(Dag1.A.class);
                }
            },
            new AbstractModule()
            {
                @Override
                protected void configure()
                {
                    bind(Dag1.B.class);
                }
            },
            new AbstractModule()
            {
                @Override
                protected void configure()
                {
                    bind(Dag1.C.class);
View Full Code Here

    }

    @Test(dataProvider = "builders")
    public void testDagInterfaceModule(LifecycleInjectorBuilder lifecycleInjectorBuilder) throws Exception
    {
        final Module dag1Module = new AbstractModule()
        {
            @Override
            protected void configure()
            {
                bind(DagInterface.A.class).to(DagInterface.AImpl.class);
View Full Code Here

*/
public class BootstrapMain {
    public static void main(final String args[]) {
        try {
            Class<?> mainClass = Class.forName(args[0]);
            LifecycleInjector.bootstrap(mainClass, new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Arguments.class).toInstance(new Arguments(args));
                }
            });
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.