本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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);
}
示例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));
});
}
示例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));
});
}
示例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));
});
}
示例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);
}
示例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();
}
示例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();
}
示例14: builder
import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
return initialBuilder
.in(context.environment())
.bindings(new PushServicesModule());
}
示例15: provideApplication
import play.inject.guice.GuiceApplicationBuilder; //导入依赖的package包/类
@Override
protected Application provideApplication() {
return new GuiceApplicationBuilder().build();
}