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

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

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

Bootstrap.run介绍

[英]Runs the bootstrap's bundles with the given configuration and environment.
[中]使用给定的配置和环境运行引导包。

代码示例

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

@Override
  public void run(C configuration, Environment environment) throws Exception {
    environment.lifecycle().addServerLifecycleListener(server -> jettyServer = server);
    DropwizardTestSupport.this.configuration = configuration;
    DropwizardTestSupport.this.environment = environment;
    super.run(configuration, environment);
    for (ServiceListener<C> listener : listeners) {
      try {
        listener.onRun(configuration, environment, DropwizardTestSupport.this);
      } catch (Exception ex) {
        throw new RuntimeException("Error running app rule start listener", ex);
      }
    }
  }
};

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

@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
  final Environment environment = new Environment(bootstrap.getApplication().getName(),
                          bootstrap.getObjectMapper(),
                          bootstrap.getValidatorFactory(),
                          bootstrap.getMetricRegistry(),
                          bootstrap.getClassLoader(),
                          bootstrap.getHealthCheckRegistry());
  configuration.getMetricsFactory().configure(environment.lifecycle(),
                        bootstrap.getMetricRegistry());
  configuration.getServerFactory().configure(environment);
  bootstrap.run(configuration, environment);
  application.run(configuration, environment);
  run(environment, namespace, configuration);
}

代码示例来源:origin: ru.vyarus/dropwizard-guicey

@Override
  public void run(final C configuration, final Environment environment) throws Exception {
    GuiceyAppRule.this.configuration = configuration;
    GuiceyAppRule.this.environment = environment;
    super.run(configuration, environment);
  }
};

代码示例来源:origin: xvik/dropwizard-guicey

@Override
  public void run(final C configuration, final Environment environment) throws Exception {
    GuiceyAppRule.this.configuration = configuration;
    GuiceyAppRule.this.environment = environment;
    super.run(configuration, environment);
  }
};

代码示例来源:origin: io.dropwizard/dropwizard-core

@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
  final Environment environment = new Environment(bootstrap.getApplication().getName(),
                          bootstrap.getObjectMapper(),
                          bootstrap.getValidatorFactory().getValidator(),
                          bootstrap.getMetricRegistry(),
                          bootstrap.getClassLoader(),
                          bootstrap.getHealthCheckRegistry());
  configuration.getMetricsFactory().configure(environment.lifecycle(),
                        bootstrap.getMetricRegistry());
  configuration.getServerFactory().configure(environment);
  bootstrap.run(configuration, environment);
  application.run(configuration, environment);
  run(environment, namespace, configuration);
}

代码示例来源:origin: io.dropwizard/dropwizard-testing

@Override
  public void run(C configuration, Environment environment) throws Exception {
    environment.lifecycle().addServerLifecycleListener(server -> jettyServer = server);
    DropwizardTestSupport.this.configuration = configuration;
    DropwizardTestSupport.this.environment = environment;
    super.run(configuration, environment);
    for (ServiceListener<C> listener : listeners) {
      try {
        listener.onRun(configuration, environment, DropwizardTestSupport.this);
      } catch (Exception ex) {
        throw new RuntimeException("Error running app rule start listener", ex);
      }
    }
  }
};

代码示例来源:origin: openstack/monasca-common

@Override
 public void run(C configuration, Environment environment) throws Exception {
  environment.lifecycle().addServerLifecycleListener(new ServerLifecycleListener() {
   @Override
   public void serverStarted(Server server) {
    jettyServer = server;
   }
  });
  AbstractAppTest.this.configuration = configuration;
  AbstractAppTest.this.environment = environment;
  super.run(configuration, environment);
 }
};

相关文章