use of com.google.inject.Provides in project airpal by airbnb.
the class DropwizardModule method provideObjectMapper.
@Singleton
@Provides
protected ObjectMapper provideObjectMapper() {
ObjectMapper mapper = environment.getObjectMapper();
mapper.registerSubtypes(new NamedType(CSVPersistentOutput.class, "csv"), new NamedType(HiveTablePersistentOutput.class, "hive"));
Rosetta.getMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Rosetta.getMapper().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
return mapper;
}
use of com.google.inject.Provides in project jmxtrans by jmxtrans.
the class JmxTransModule method scheduler.
@Provides
@Inject
Scheduler scheduler(JmxTransConfiguration configuration, GuiceJobFactory jobFactory) throws SchedulerException, IOException {
StdSchedulerFactory serverSchedFact = new StdSchedulerFactory();
try (InputStream stream = openQuartzConfiguration(configuration)) {
serverSchedFact.initialize(stream);
}
Scheduler scheduler = serverSchedFact.getScheduler();
scheduler.setJobFactory(jobFactory);
return scheduler;
}
use of com.google.inject.Provides in project hudson-2.x by hudson.
the class HudsonModule method getPluginManager.
@Provides
private PluginManager getPluginManager() {
PluginManager target = plugins != null ? plugins : getHudson().getPluginManager();
checkState(target != null);
return target;
}
use of com.google.inject.Provides in project ninja by ninjaframework.
the class LifecycleSupportTest method providedSingletonDisposableShouldBeDisposed.
@Test
public void providedSingletonDisposableShouldBeDisposed() {
Injector injector = createInjector(new AbstractModule() {
@Override
protected void configure() {
}
@Provides
@Singleton
public MockSingletonService provide() {
return new MockSingletonService();
}
});
start(injector);
stop(injector);
assertThat(MockSingletonService.disposed, equalTo(1));
}
use of com.google.inject.Provides in project PocketHub by pockethub.
the class PocketHubModule method account.
@Provides
Account account(Context context) {
AccountManager accountManager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = accountManager.getAccountsByType(context.getString(R.string.account_type));
return accounts[0];
}
Aggregations