Search in sources :

Example 1 with Singleton

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;
}
Also used : JacksonSmileProvider(com.fasterxml.jackson.jaxrs.smile.JacksonSmileProvider) LazySingleton(io.druid.guice.LazySingleton) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 2 with Singleton

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;
}
Also used : JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) LazySingleton(io.druid.guice.LazySingleton) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 3 with Singleton

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;
}
Also used : IResourceResolver(org.thymeleaf.resourceresolver.IResourceResolver) FileSystemBindingThymeleafResourceResolver(ratpack.thymeleaf.internal.FileSystemBindingThymeleafResourceResolver) TemplateResolver(org.thymeleaf.templateresolver.TemplateResolver) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 4 with Singleton

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;
}
Also used : TemplateEngine(org.thymeleaf.TemplateEngine) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 5 with Singleton

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;
}
Also used : Shutdowner(com.torodb.core.Shutdowner) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Singleton (com.google.inject.Singleton)74 Provides (com.google.inject.Provides)71 AbstractModule (com.google.inject.AbstractModule)8 Injector (com.google.inject.Injector)8 Named (com.google.inject.name.Named)7 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)7 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)7 Model (org.ovirt.engine.ui.uicommonweb.models.Model)7 IOException (java.io.IOException)5 SearchableDetailTabModelProvider (org.ovirt.engine.ui.common.uicommon.model.SearchableDetailTabModelProvider)5 PermissionListModel (org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel)5 DataSourceFactory (io.dropwizard.db.DataSourceFactory)4 ManagedDataSource (io.dropwizard.db.ManagedDataSource)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 File (java.io.File)3 InetSocketAddress (java.net.InetSocketAddress)3 SocketAddress (java.net.SocketAddress)3 Properties (java.util.Properties)3 Test (org.junit.Test)3 ConfigModule (co.cask.cdap.common.guice.ConfigModule)2