当前位置: 首页>>代码示例>>Java>>正文


Java GuiceBundle类代码示例

本文整理汇总了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);
}
 
开发者ID:MineboxOS,项目名称:minebox,代码行数:18,代码来源:MinebdApplication.java

示例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);
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:24,代码来源:DropwizardService.java

示例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)
        )
    );
}
 
开发者ID:gov-ithub,项目名称:StopCozi-api,代码行数:26,代码来源:Server.java

示例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);
}
 
开发者ID:katharsis-project,项目名称:katharsis-framework,代码行数:24,代码来源:DropwizardService.java

示例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());
}
 
开发者ID:G1GC,项目名称:dropwizard-microservices-example,代码行数:19,代码来源:ProductCatalogApplication.java

示例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());
}
 
开发者ID:G1GC,项目名称:dropwizard-microservices-example,代码行数:19,代码来源:ProductReviewApplication.java

示例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);
}
 
开发者ID:HubSpot,项目名称:Nebula,代码行数:22,代码来源:NebulaService.java

示例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());
}
 
开发者ID:yokuze,项目名称:dropwizard-backbone-app,代码行数:23,代码来源:AppService.java

示例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);

}
 
开发者ID:oregami,项目名称:oregami-server,代码行数:24,代码来源:OregamiApplication.java

示例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());
}
 
开发者ID:G1GC,项目名称:dropwizard-microservices-example,代码行数:12,代码来源:APIGatewayApplication.java

示例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();
}
 
开发者ID:blstream,项目名称:AugumentedSzczecin_java,代码行数:40,代码来源:AugmentedApplication.java

示例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);
}
 
开发者ID:cdelmas,项目名称:microservices-comparison,代码行数:14,代码来源:DropwizardApplication.java

示例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);
}
 
开发者ID:QSD,项目名称:tardis,代码行数:16,代码来源:ApplicationService.java

示例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()
			);


}
 
开发者ID:paraam,项目名称:tr069-simulator,代码行数:14,代码来源:SimulatorService.java


注:本文中的com.hubspot.dropwizard.guice.GuiceBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。