io.dropwizard.setup.Bootstrap.addBundle()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中io.dropwizard.setup.Bootstrap.addBundle()方法的一些代码示例,展示了Bootstrap.addBundle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap.addBundle()方法的具体详情如下:
包路径:io.dropwizard.setup.Bootstrap
类名称:Bootstrap
方法名:addBundle

Bootstrap.addBundle介绍

[英]Adds the given bundle to the bootstrap.
[中]将给定的绑定添加到引导。

代码示例

代码示例来源:origin: signalapp/BitHub

@Override
public void initialize(Bootstrap<BithubServerConfiguration> bootstrap) {
 bootstrap.addBundle(new ViewBundle());
}

代码示例来源:origin: dropwizard/dropwizard

@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
  // Enable variable substitution with environment variables
  bootstrap.setConfigurationSourceProvider(
      new SubstitutingSourceProvider(
          bootstrap.getConfigurationSourceProvider(),
          new EnvironmentVariableSubstitutor(false)
      )
  );
  bootstrap.addCommand(new RenderCommand());
  bootstrap.addBundle(new AssetsBundle());
  bootstrap.addBundle(new MigrationsBundle<HelloWorldConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) {
      return configuration.getDataSourceFactory();
    }
  });
  bootstrap.addBundle(hibernateBundle);
  bootstrap.addBundle(new ViewBundle<HelloWorldConfiguration>() {
    @Override
    public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) {
      return configuration.getViewRendererConfiguration();
    }
  });
}

代码示例来源:origin: graphhopper/graphhopper

@Override
public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) {
  bootstrap.addBundle(new GraphHopperBundle());
  bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/maps/", "index.html"));
  bootstrap.addCommand(new ImportCommand(bootstrap.getObjectMapper()));
}

代码示例来源:origin: signalapp/Signal-Server

@Override
public void initialize(Bootstrap<WhisperServerConfiguration> bootstrap) {
 bootstrap.addCommand(new DirectoryCommand());
 bootstrap.addCommand(new VacuumCommand());
 bootstrap.addCommand(new TrimMessagesCommand());
 bootstrap.addCommand(new PeriodicStatsCommand());
 bootstrap.addCommand(new DeleteUserCommand());
 bootstrap.addCommand(new CertificateCommand());
 bootstrap.addBundle(new NameableMigrationsBundle<WhisperServerConfiguration>("accountdb", "accountsdb.xml") {
  @Override
  public DataSourceFactory getDataSourceFactory(WhisperServerConfiguration configuration) {
   return configuration.getDataSourceFactory();
  }
 });
 bootstrap.addBundle(new NameableMigrationsBundle<WhisperServerConfiguration>("messagedb", "messagedb.xml") {
  @Override
  public DataSourceFactory getDataSourceFactory(WhisperServerConfiguration configuration) {
   return configuration.getMessageStoreConfiguration();
  }
 });
 bootstrap.addBundle(new NameableMigrationsBundle<WhisperServerConfiguration>("abusedb", "abusedb.xml") {
  @Override
  public PooledDataSourceFactory getDataSourceFactory(WhisperServerConfiguration configuration) {
   return configuration.getAbuseDatabaseConfiguration();
  }
 });
}

代码示例来源:origin: HubSpot/Singularity

.modules(additionalModules)
  .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) {
 bootstrap.addBundle(bundle);
 bootstrap.addBundle(configuredBundle);

代码示例来源:origin: jtanza/rufus

@Override
public void initialize(Bootstrap<RufusConfiguration> bootstrap) {
  bootstrap.addBundle(new AssetsBundle("/app", "/", "index.html"));
  bootstrap.addBundle(new ViewBundle<>());
  bootstrap.addBundle(new MultiPartBundle());
  bootstrap.addBundle(new MigrationsBundle<RufusConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(RufusConfiguration conf) {
      return conf.getDataSourceFactory();
    }
  });
}

代码示例来源:origin: Yubico/java-u2flib-server

@Override
public void initialize(Bootstrap<Config> bootstrap) {
  bootstrap.addBundle(new ViewBundle());
  bootstrap.addBundle(new AssetsBundle());
}

代码示例来源:origin: stanford-futuredata/macrobase

@Override
public void initialize(Bootstrap<MacroBaseConf> bootstrap) {
  bootstrap.addBundle(new AssetsBundle("/frontend", "/", "console.html"));
}

代码示例来源:origin: pinterest/doctorkafka

@Override
public void initialize(Bootstrap<DoctorKafkaAppConfig> bootstrap) {
 bootstrap.addBundle(new AssetsBundle("/webapp/pages/", "/", "index.html"));
}

代码示例来源:origin: Yubico/java-u2flib-server

@Override
public void initialize(Bootstrap<Config> bootstrap) {
  bootstrap.addBundle(new ViewBundle());
  bootstrap.addBundle(new AssetsBundle());
}

代码示例来源:origin: com.graphhopper/graphhopper-web

@Override
public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) {
  bootstrap.addBundle(new GraphHopperBundle());
  bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/maps/", "index.html"));
  bootstrap.addCommand(new ImportCommand(bootstrap.getObjectMapper()));
}

代码示例来源:origin: epam/DLab

@Override
public void initialize(Bootstrap<SelfServiceApplicationConfiguration> bootstrap) {
  super.initialize(bootstrap);
  bootstrap.addBundle(new MultiPartBundle());
  bootstrap.addBundle(new AssetsBundle("/webapp/dist", "/", "index.html"));
  bootstrap.addBundle(new TemplateConfigBundle(
      new TemplateConfigBundleConfiguration().fileIncludePath(ServiceUtils.getConfPath())
  ));
}

代码示例来源:origin: org.opennms.newts/newts-rest

@Override
public void initialize(Bootstrap<NewtsConfig> bootstrap) {
  bootstrap.addCommand(new InitCommand());
  bootstrap.addBundle(new AssetsBundle("/app", UI_URL_PATH, "index.html"));
}

代码示例来源:origin: OpenNMS/newts

@Override
public void initialize(Bootstrap<NewtsConfig> bootstrap) {
  bootstrap.addCommand(new InitCommand());
  bootstrap.addBundle(new AssetsBundle("/app", UI_URL_PATH, "index.html"));
}

代码示例来源:origin: graphhopper/map-matching

@Override
public void initialize(Bootstrap<MapMatchingServerConfiguration> bootstrap) {
  bootstrap.addBundle(new GraphHopperBundle());
  bootstrap.addCommand(new ImportCommand());
  bootstrap.addCommand(new MatchCommand());
  bootstrap.addCommand(new GetBoundsCommand());
  bootstrap.addCommand(new MeasurementCommand());
  bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/mapmatching-webapp/", "/app/", "index.html"));
}

代码示例来源:origin: epam/DLab

@Override
public void initialize(Bootstrap<SecurityServiceConfiguration> bootstrap) {
  bootstrap.addBundle(new TemplateConfigBundle(
      new TemplateConfigBundleConfiguration().fileIncludePath(ServiceUtils.getConfPath())
  ));
}

代码示例来源:origin: com.hubspot.dropwizard/dropwizard-guice

@Override
public void initialize(final Bootstrap<Configuration> bootstrap) {
  final GuiceBundle<Configuration> jersey2GuiceBundle = newBuilder()
      .addModule(new TestModule())
      .enableAutoConfig(this.getClass().getPackage().getName())
      .build();
  bootstrap.addBundle(jersey2GuiceBundle);
}

代码示例来源:origin: mokies/ratelimitj

@Override
public void initialize(Bootstrap<Configuration> bootstrap) {
  redisClient = RedisClient.create("redis://localhost:7006");
  RequestRateLimiterFactory factory = new RedisRateLimiterFactory(redisClient);
  //RequestRateLimiterFactory factory = new InMemoryRateLimiterFactory();
  bootstrap.addBundle(new RateLimitBundle(factory));
}

代码示例来源:origin: mesosphere/dcos-cassandra-service

@Override
public void initialize(Bootstrap<MutableSchedulerConfiguration> bootstrap) {
 super.initialize(bootstrap);
 StrSubstitutor strSubstitutor = new StrSubstitutor(new EnvironmentVariableLookup(false));
 strSubstitutor.setEnableSubstitutionInVariables(true);
 bootstrap.addBundle(new Java8Bundle());
 bootstrap.setConfigurationSourceProvider(
  new SubstitutingSourceProvider(
   bootstrap.getConfigurationSourceProvider(),
   strSubstitutor));
}

代码示例来源:origin: com.hubspot.dropwizard/dropwizard-guicier

@Override
public void initialize(final Bootstrap<Configuration> bootstrap) {
  final GuiceBundle<Configuration> jersey2GuiceBundle = GuiceBundle.defaultBuilder(Configuration.class)
    .modules(new TestModule())
    .build();
  bootstrap.addBundle(jersey2GuiceBundle);
}

相关文章