当前位置: 首页>>代码示例>>Java>>正文


Java GuiceApplicationBuilder类代码示例

本文整理汇总了Java中play.inject.guice.GuiceApplicationBuilder的典型用法代码示例。如果您正苦于以下问题:Java GuiceApplicationBuilder类的具体用法?Java GuiceApplicationBuilder怎么用?Java GuiceApplicationBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GuiceApplicationBuilder类属于play.inject.guice包,在下文中一共展示了GuiceApplicationBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startApplicationTest

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@BeforeClass
public static void startApplicationTest() {
    // Mock the router binding.
    Binding<Router> routesBindingOverride = new BindingKey<>(Router.class)
            .toProvider(MockRouterProvider.class)
            .eagerly();

    application = new GuiceApplicationBuilder()
            .in(Mode.TEST)
            .configure("db.pushservices.name", "pushservices")
            .configure("db.pushservices.driver", "org.postgresql.Driver")
            .configure("db.pushservices.connectionTimeout", "10 seconds")
            .configure("db.pushservices.url", "jdbc:postgresql://localhost:5432/pushservices")
            .configure("db.pushservices.username", "YOUR_USERNAME")
            .configure("db.pushservices.password", "YOUR_PASSWORD")
            .overrides(routesBindingOverride)
            .build();
}
 
开发者ID:splendidbits,项目名称:play-pushservices,代码行数:19,代码来源:PushServicesApplicationTest.java

示例2: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {

    final Map<String, Object> additionalConfiguration = new HashMap<>();
    additionalConfiguration.putAll(Helpers.inMemoryDatabase());

    additionalConfiguration.put("smtp.mock", "true");

    amendConfiguration(additionalConfiguration);

    return new GuiceApplicationBuilder()
            .bindings(
                    bind(getProviderClass()).toSelf().eagerly()
            )
            .configure(additionalConfiguration)
            .overrides(bind(MyUserService.class).to(MyTestUserServiceService.class).eagerly())
            .build();
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:19,代码来源:OAuth2Test.java

示例3: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
    return new GuiceApplicationBuilder()
            .overrides(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SphereClient.class).toInstance(sphereClient);
                }
            }).build();
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java-training,代码行数:11,代码来源:WithSphereClient.java

示例4: builder

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
public GuiceApplicationBuilder builder(Context context) {
    org.iatoki.judgels.jophiel.BuildInfo$ buildInfo = org.iatoki.judgels.jophiel.BuildInfo$.MODULE$;
    JudgelsPlayProperties.buildInstance(buildInfo.name(), buildInfo.version(), ConfigFactory.load());

    Config config = ConfigFactory.load();
    JophielProperties.buildInstance(config);

    return super.builder(context);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:11,代码来源:JophielApplicationLoader.java

示例5: testLocalFilesystemStorageMapping

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Test
public void testLocalFilesystemStorageMapping () {
    Application application = new GuiceApplicationBuilder()
            .configure("storage.type", "local")
            .build();

    running (application, () -> {
        Storage instance = application.injector().instanceOf(Storage.class);
        assertThat("Storage has not been mapped", instance, notNullValue());
        assertThat("Storage has been mapped to a wrong type", instance instanceof LocalFilesystemStorage, is(true));
    });
}
 
开发者ID:thunderbit,项目名称:thunderbit,代码行数:13,代码来源:StorageModuleTest.java

示例6: testAmazonS3StorageMapping

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Test
public void testAmazonS3StorageMapping () {
    Application application = new GuiceApplicationBuilder()
            .configure("storage.type", "s3")
            .configure("storage.s3.accesskey", "")
            .configure("storage.s3.secretkey", "")
            .configure("storage.s3.createBucket", false)
            .build();

    running (application, () -> {
        Storage instance = application.injector().instanceOf(Storage.class);
        assertThat("Storage has not been mapped", instance, notNullValue());
        assertThat("Storage has been mapped to a wrong type", instance instanceof AmazonS3Storage, is(true));
    });
}
 
开发者ID:thunderbit,项目名称:thunderbit,代码行数:16,代码来源:StorageModuleTest.java

示例7: testMockStorageMapping

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Test
public void testMockStorageMapping () {
    Application application = new GuiceApplicationBuilder()
            .configure("storage.type", "mock")
            .build();

    running (application, () -> {
        Storage instance = application.injector().instanceOf(Storage.class);
        assertThat("Storage has not been mapped", instance, notNullValue());
        assertThat("Storage has been mapped to a wrong type", instance instanceof MockStorage, is(true));
    });
}
 
开发者ID:thunderbit,项目名称:thunderbit,代码行数:13,代码来源:StorageModuleTest.java

示例8: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
    return new GuiceApplicationBuilder()
            .overrides(
                    bind(SphereClient.class).toInstance(sphereClient),
                    bind(CartInSession.class).toInstance(cartInSession)
            ).build();
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:9,代码来源:AddDiscountCodeControllerIntegrationTest.java

示例9: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
    return new GuiceApplicationBuilder()
            .overrides(
                    bind(SphereClient.class).toInstance(sphereClient),
                    bind(EmailSender.class).toInstance(emailSender)
            ).build();
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:9,代码来源:RecoverPasswordControllerIntegrationTest.java

示例10: testServer

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
private TestServer testServer(final boolean isAuthEnabled) {
    final Router router = new RoutingDsl()
            .GET(URI).routeTo(() -> ok())
            .build();
    final Application app = new GuiceApplicationBuilder()
            .configure("play.http.filters", "com.commercetools.sunrise.httpauth.basic.BasicHttpAuthenticationFilters")
            .overrides(
                    bind(HttpAuthentication.class).toInstance(httpAuthentication(isAuthEnabled)),
                    bind(play.api.routing.Router.class).toInstance(router.asScala()))
            .build();
    return Helpers.testServer(app);
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:13,代码来源:HttpAuthenticationFilterTest.java

示例11: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
    final Router router = new RoutingDsl()
            .GET(URI).routeTo(() -> ok())
            .build();
    return new GuiceApplicationBuilder()
            .configure("play.http.filters", "com.commercetools.sunrise.httpauth.basic.BasicHttpAuthenticationFilters")
            .overrides(
                    bind(HttpAuthentication.class).toInstance(new BasicHttpAuthentication(REALM, USERNAME + ":" + PASSWORD)),
                    bind(play.api.routing.Router.class).toInstance(router.asScala()))
            .build();
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:13,代码来源:BasicHttpAuthenticationFilterTest.java

示例12: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
    final Module module = new AbstractModule() {
        @Override
        protected void configure() {
            bindScope(RequestScoped.class, new RequestScope());
        }
    };
    return new GuiceApplicationBuilder()
            .overrides(module)
            .build();
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:13,代码来源:RequestScopedTest.java

示例13: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
public Application provideApplication() {
  Geolocation geolocation = new Geolocation(ipAddress, countryCode);

  GeolocationProvider provider = Mockito.mock(GeolocationProvider.class);
  Mockito.when(provider.get(ipAddress)).thenReturn(CompletableFuture.completedFuture(geolocation));

  return new GuiceApplicationBuilder()
    .in(new File("."))
    .in(Mode.TEST)
    .configure("geolocation.cache.on", true)
    .bindings(bind(GeolocationProvider.class).toInstance(provider))
    .build();
}
 
开发者ID:edulify,项目名称:play-geolocation-module.edulify.com,代码行数:15,代码来源:GeolocationServiceTest.java

示例14: builder

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
    return initialBuilder
            .in(context.environment())
            .bindings(new PushServicesModule());
}
 
开发者ID:splendidbits,项目名称:play-pushservices,代码行数:7,代码来源:ApplicationClassLoader.java

示例15: provideApplication

import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
    return new GuiceApplicationBuilder().build();
}
 
开发者ID:Clivern,项目名称:Racter,代码行数:5,代码来源:$model__Camel$ControllerTest.java


注:本文中的play.inject.guice.GuiceApplicationBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。