本文整理汇总了Java中com.hubspot.dropwizard.guice.GuiceBundle类的典型用法代码示例。如果您正苦于以下问题:Java GuiceBundle类的具体用法?Java GuiceBundle怎么用?Java GuiceBundle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiceBundle类属于com.hubspot.dropwizard.guice包,在下文中一共展示了GuiceBundle类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ApiConfig> bootstrap) {
guiceBundle = GuiceBundle.<ApiConfig>newBuilder()
.setConfigClass(ApiConfig.class)
.addModule(new MineBdModule())
.build();
bootstrap.addBundle(guiceBundle);
SwaggerBundle<ApiConfig> swagger = new SwaggerBundle<ApiConfig>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(ApiConfig configuration) {
return configuration.swagger;
}
};
bootstrap.addBundle(swagger);
}
示例2: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<DropwizardConfiguration> bootstrap) {
guiceBundle = GuiceBundle.<DropwizardConfiguration>newBuilder()
.addModule(new AbstractModule() {
@Provides
public MongoManaged mongoManaged(DropwizardConfiguration configuration) throws Exception {
return new MongoManaged(configuration.mongo);
}
@Override
protected void configure() {
bind(ProjectRepository.class);
bind(TaskRepository.class);
bind(TaskToProjectRepository.class);
}
})
.setConfigClass(DropwizardConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
}
示例3: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ServerConfiguration> bootstrap) {
bootstrap.addBundle(hibernateBundle);
bootstrap.addBundle(new AssetsBundle("/swagger-spec", "/api-spec", null));
bootstrap.addBundle(GuiceBundle.<ServerConfiguration>newBuilder()
.addModule(new AbstractModule(){
@Override protected void configure() {}
@Provides SessionFactory sessionFactoryProvider() { return hibernateBundle.getSessionFactory();}
})
.setConfigClass(ServerConfiguration.class)
.enableAutoConfig(getClass().getPackage().getName())
.build(Stage.DEVELOPMENT)
);
bootstrap.addBundle(new Java8Bundle());
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
}
示例4: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<DropwizardConfiguration> bootstrap) {
guiceBundle = GuiceBundle.<DropwizardConfiguration>newBuilder()
.addModule(new AbstractModule() {
@Override
protected void configure() {
bind(ProjectRepository.class);
bind(TaskRepository.class);
bind(TaskToProjectRepository.class);
}
@Provides
public MongoManaged mongoManaged(DropwizardConfiguration configuration) throws Exception {
return new MongoManaged(configuration.mongo);
}
})
.setConfigClass(DropwizardConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
}
示例5: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(final Bootstrap<ProductCatalogConfiguration> bootstrap) {
bootstrap.addBundle(discoveryBundle);
bootstrap.addBundle(new MigrationsBundle<ProductCatalogConfiguration>() {
@Override
public PooledDataSourceFactory getDataSourceFactory(ProductCatalogConfiguration configuration) {
return configuration.getDataSourceFactory();
}
});
guiceBundle = GuiceBundle.<ProductCatalogConfiguration> newBuilder().addModule(new ProductCatalogModule())
.enableAutoConfig(getClass().getPackage().getName()).setConfigClass(ProductCatalogConfiguration.class)
.build(Stage.PRODUCTION);
bootstrap.addBundle(guiceBundle);
// Uncomment below to read the yaml file from Jar
// bootstrap.setConfigurationSourceProvider(new
// ResourceConfigurationSourceProvider());
}
示例6: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(final Bootstrap<ProductReviewConfiguration> bootstrap) {
bootstrap.addBundle(discoveryBundle);
bootstrap.addBundle(new MigrationsBundle<ProductReviewConfiguration>() {
@Override
public PooledDataSourceFactory getDataSourceFactory(ProductReviewConfiguration configuration) {
return configuration.getDataSourceFactory();
}
});
guiceBundle = GuiceBundle.<ProductReviewConfiguration> newBuilder().addModule(new ProductReviewModule())
.enableAutoConfig(getClass().getPackage().getName()).setConfigClass(ProductReviewConfiguration.class)
.build(Stage.PRODUCTION);
bootstrap.addBundle(guiceBundle);
// Uncomment below to read the yaml file from Jar
// bootstrap.setConfigurationSourceProvider(new
// ResourceConfigurationSourceProvider());
}
示例7: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<NebulaServiceConfiguration> bootstrap) {
GuiceBundle<NebulaServiceConfiguration> guiceBundle = GuiceBundle.<NebulaServiceConfiguration>newBuilder()
.addModule(new NebulaServiceModule())
.enableAutoConfig(getClass().getPackage().getName())
.setConfigClass(NebulaServiceConfiguration.class)
.build(Stage.DEVELOPMENT);
bootstrap.addBundle(guiceBundle);
// database migrations
bootstrap.addBundle(new MigrationsBundle<NebulaServiceConfiguration>() {
@Override
public DataSourceFactory getDataSourceFactory(NebulaServiceConfiguration configuration) {
return configuration.getDatabase();
}
});
bootstrap.getObjectMapper().registerModule(new ProtobufModule());
bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
示例8: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<AppConfiguration> bootstrap) {
ImmutableList<Class<?>> classes = scanForEntities();
hibernate = new HibernateBundle<AppConfiguration>(classes, new SessionFactoryFactory()) {
@Override
public DataSourceFactory getDataSourceFactory(AppConfiguration configuration) {
return configuration.getDatabase();
}
};
bootstrap.addBundle(hibernate);
db = new DB();
bootstrap.addBundle(new AssetsBundle("/assets/", "/", "index.htm"));
devModule = new AppDevModule(db);
bootstrap.addBundle(GuiceBundle.newBuilder()
.addModule(devModule)
.enableAutoConfig(getClass().getPackage().getName())
.build());
}
示例9: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<OregamiConfiguration> bootstrap) {
OregamiConfiguration configuration = StartHelper.createConfiguration(StartHelper.getConfigFilename());
Properties jpaProperties = StartHelper.createPropertiesFromConfiguration(configuration);
JpaPersistModule jpaPersistModule = new JpaPersistModule(configuration.getDatabaseConfiguration().getJpaUnit());
jpaPersistModule.properties(jpaProperties);
guiceBundle = GuiceBundle.<OregamiConfiguration>newBuilder()
.addModule(new OregamiGuiceModule())
.addModule(jpaPersistModule)
.enableAutoConfig("org.oregami")
.setConfigClass(OregamiConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
SimpleModule module = new SimpleModule();
//module.addSerializer(LocalDateTime.class, new CustomLocalDateTimeSerializer());
//module.addSerializer(LocalDate.class, new CustomLocalDateSerializer());
bootstrap.getObjectMapper().registerModule(module);
}
示例10: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(final Bootstrap<APIGatewayConfiguration> bootstrap) {
bootstrap.addBundle(discoveryBundle);
guiceBundle = GuiceBundle.<APIGatewayConfiguration> newBuilder().addModule(new APIGatewayModule())
.enableAutoConfig(getClass().getPackage().getName()).setConfigClass(APIGatewayConfiguration.class)
.build(Stage.PRODUCTION);
bootstrap.addBundle(guiceBundle);
// Uncomment below to read the yaml file from Jar
// bootstrap.setConfigurationSourceProvider(new
// ResourceConfigurationSourceProvider());
}
示例11: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(final Bootstrap<AugmentedConfiguration> bootstrap) {
// Enable configuration variable substitution with system property values
final StrSubstitutor systemPropertyStrSubstitutor = new StrSubstitutor(StrLookup.systemPropertiesLookup());
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), systemPropertyStrSubstitutor));
// setup guice builder
final Builder<AugmentedConfiguration> guiceConfiguration = GuiceBundle.<AugmentedConfiguration>newBuilder() //
.addModule(new AugmentedModule()) //
.addModule(new OpenDataClientModule()) //
.enableAutoConfig(getClass().getPackage().getName()) //
.setConfigClass(AugmentedConfiguration.class);
// setup db backend based - choice i based on system property value
if (isDbTypeSetToMongodb(systemPropertyStrSubstitutor.getVariableResolver().lookup(DBTYPE_PROPERTY_NAME))) {
guiceConfiguration.addModule(new MongodbModule());
} else {
bootstrap.addBundle(createMigrationBundle());
guiceConfiguration.addModule(new RdbmsModule<AugmentedConfiguration>(bootstrap) {
@Override
public DataSourceFactory getRealDataSourceFactory(final AugmentedConfiguration configuration) {
return configuration.getRdbmsConfig();
}
@Override
public String getPackagesToScanForEntities() {
return RDBMS_ENTITIES_PACKAGE;
}
});
}
// eagerly inject all dependencies: note Stage.DEVELOPMENT it's a hack
final GuiceBundle<AugmentedConfiguration> guiceBundle = guiceConfiguration.build(Stage.DEVELOPMENT);
bootstrap.addBundle(guiceBundle);
injector = guiceBundle.getInjector();
}
示例12: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<DropwizardServerConfiguration> bootstrap) {
guiceBundle = GuiceBundle.<DropwizardServerConfiguration>newBuilder()
.addModule(new HelloModule())
.addModule(new CarModule())
.setConfigClass(DropwizardServerConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new Java8Bundle());
ObjectMapper objectMapper = bootstrap.getObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
示例13: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<TardisConfiguration> bootstrap) {
GuiceBundle<TardisConfiguration> guiceBundle = GuiceBundle.<TardisConfiguration>newBuilder()
// No specific module needed, will auto detect them.
.addModule(new AbstractModule() {
@Override
protected void configure() {
}
})
.enableAutoConfig("nl.qsd.tardis")
.setConfigClass(TardisConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
}
示例14: initialize
import com.hubspot.dropwizard.guice.GuiceBundle; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<SimulatorConfiguration> bootstrap) {
bootstrap.setName("TR069-Simulator");
bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/dashboard/") );
bootstrap.addBundle(new ViewBundle());
bootstrap.addBundle(GuiceBundle.newBuilder()
.addModule(new SimulatorModule())
.enableAutoConfig(getClass().getPackage().getName())
.build()
);
}