com.hubspot.dropwizard.guicier.GuiceBundle Java Examples
The following examples show how to use
com.hubspot.dropwizard.guicier.GuiceBundle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestApplication.java From dropwizard-guicier with Apache License 2.0 | 5 votes |
@Override public void initialize(final Bootstrap<Configuration> bootstrap) { final GuiceBundle<Configuration> jersey2GuiceBundle = GuiceBundle.defaultBuilder(Configuration.class) .modules(new TestModule()) .build(); bootstrap.addBundle(jersey2GuiceBundle); }
Example #2
Source File: BaragonAgentService.java From Baragon with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<BaragonAgentConfiguration> bootstrap) { guiceBundle = GuiceBundle.defaultBuilder(BaragonAgentConfiguration.class) .modules(new BaragonAgentServiceModule()) .build(); bootstrap.addBundle(new CorsBundle()); bootstrap.addBundle(guiceBundle); bootstrap.addBundle(new BaragonAuthBundle()); }
Example #3
Source File: BaragonService.java From Baragon with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<T> bootstrap) { if (!Strings.isNullOrEmpty(System.getProperty(BARAGON_DEFAULT_CONFIG_LOCATION))) { bootstrap.setConfigurationSourceProvider( new MergingConfigProvider( bootstrap.getConfigurationSourceProvider(), System.getProperty(BARAGON_DEFAULT_CONFIG_LOCATION), bootstrap.getObjectMapper(), new YAMLFactory())); } final Iterable<? extends Module> additionalModules = checkNotNull(getGuiceModules(bootstrap), "getGuiceModules() returned null"); GuiceBundle<BaragonConfiguration> guiceBundle = GuiceBundle.defaultBuilder(BaragonConfiguration.class) .modules(new BaragonServiceModule()) .modules(new BaragonResourcesModule()) .modules(getObjectMapperModule()) .modules(additionalModules) .enableGuiceEnforcer(false) .stage(getGuiceStage()) .build(); bootstrap.addBundle(new CorsBundle()); bootstrap.addBundle(new BaragonAuthBundle()); bootstrap.addBundle(guiceBundle); bootstrap.addBundle(new ViewBundle<>()); bootstrap.addBundle(new AssetsBundle("/assets/static/", "/static/")); }
Example #4
Source File: SingularityService.java From Singularity with Apache License 2.0 | 4 votes |
@Override public void initialize(final Bootstrap<T> bootstrap) { if ( !Strings.isNullOrEmpty( System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY) ) ) { bootstrap.setConfigurationSourceProvider( new MergingSourceProvider( bootstrap.getConfigurationSourceProvider(), System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY), bootstrap.getObjectMapper(), new YAMLFactory() ) ); } final Iterable<? extends Module> additionalModules = checkNotNull( getGuiceModules(bootstrap), "getGuiceModules() returned null" ); final Iterable<? extends Bundle> additionalBundles = checkNotNull( getDropwizardBundles(bootstrap), "getDropwizardBundles() returned null" ); final Iterable<? extends ConfiguredBundle<T>> additionalConfiguredBundles = checkNotNull( getDropwizardConfiguredBundles(bootstrap), "getDropwizardConfiguredBundles() returned null" ); guiceBundle = GuiceBundle .defaultBuilder(SingularityConfiguration.class) .modules(getServiceModule(), getObjectMapperModule(), new SingularityAuthModule()) .modules(additionalModules) .enableGuiceEnforcer(false) .stage(getGuiceStage()) .build(); bootstrap.addBundle(guiceBundle); bootstrap.addBundle(new CorsBundle()); bootstrap.addBundle(new ViewBundle<>()); bootstrap.addBundle(new AssetsBundle("/assets/static/", "/static/")); bootstrap.addBundle( new MigrationsBundle<SingularityConfiguration>() { @Override public DataSourceFactory getDataSourceFactory( final SingularityConfiguration configuration ) { return configuration.getDatabaseConfiguration().get(); } } ); for (Bundle bundle : additionalBundles) { bootstrap.addBundle(bundle); } for (ConfiguredBundle<T> configuredBundle : additionalConfiguredBundles) { bootstrap.addBundle(configuredBundle); } bootstrap.getObjectMapper().registerModule(new ProtobufModule()); bootstrap.getObjectMapper().registerModule(new GuavaModule()); bootstrap.getObjectMapper().registerModule(new Jdk8Module()); bootstrap.getObjectMapper().setSerializationInclusion(Include.NON_ABSENT); bootstrap .getObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); }