use of com.google.inject.Singleton in project druid by druid-io.
the class JettyServerModule method getJacksonSmileProvider.
@Provides
@Singleton
public JacksonSmileProvider getJacksonSmileProvider(@Smile ObjectMapper objectMapper) {
final JacksonSmileProvider provider = new JacksonSmileProvider();
provider.setMapper(objectMapper);
return provider;
}
use of com.google.inject.Singleton in project druid by druid-io.
the class JettyServerModule method getJacksonJsonProvider.
@Provides
@Singleton
public JacksonJsonProvider getJacksonJsonProvider(@Json ObjectMapper objectMapper) {
final JacksonJsonProvider provider = new JacksonJsonProvider();
provider.setMapper(objectMapper);
return provider;
}
use of com.google.inject.Singleton in project ratpack by ratpack.
the class ThymeleafModule method provideTemplateResolver.
@Provides
@Singleton
ITemplateResolver provideTemplateResolver(ServerConfig serverConfig, Config config) {
IResourceResolver resourceResolver = new FileSystemBindingThymeleafResourceResolver(serverConfig.getBaseDir());
TemplateResolver templateResolver = new TemplateResolver();
templateResolver.setResourceResolver(resourceResolver);
templateResolver.setTemplateMode(getTemplatesModeSetting(config));
templateResolver.setPrefix(getTemplatesPrefixSetting(config));
templateResolver.setSuffix(getTemplatesSuffixSetting(config));
templateResolver.setCacheable(getCacheSizeSetting(config) > 0);
// Never use TTL expiration
templateResolver.setCacheTTLMs(null);
return templateResolver;
}
use of com.google.inject.Singleton in project ratpack by ratpack.
the class ThymeleafModule method provideTemplateEngine.
@Provides
@Singleton
TemplateEngine provideTemplateEngine(ITemplateResolver templateResolver, ICacheManager cacheManager, Set<IDialect> dialects) {
final TemplateEngine templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.setCacheManager(cacheManager);
dialects.stream().forEach(templateEngine::addDialect);
return templateEngine;
}
use of com.google.inject.Singleton in project torodb by torodb.
the class CoreModule method createShutdowner.
@Provides
@Singleton
protected Shutdowner createShutdowner(ThreadFactory threadFactory) {
Shutdowner s = new Shutdowner(threadFactory);
s.startAsync();
s.awaitRunning();
return s;
}
Aggregations