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

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

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

Application.run介绍

[英]Parses command-line arguments and runs the application. Call this method from a public entry point in your application.
[中]解析命令行参数并运行应用程序。从应用程序中的公共入口点调用此方法。

代码示例

代码示例来源: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: stackoverflow.com

public static void main(String[] args) throws IOException {
  Weld weld = new Weld();
  WeldContainer container = weld.initialize();
  Application application = container.instance().select(Application.class).get();
  application.run();
  weld.shutdown();
}

代码示例来源:origin: rvs-fluid-it/wizard-in-a-box

@Override
public void run(C configuration,
        Environment environment) throws Exception {
  dropwizardEnvironment = environment;
  dropwizardApplication.run(configuration, environment);
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args){
  Application app = Application.getInstance();
  app.run();
}

代码示例来源: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: stackoverflow.com

public static void main(String[] args) {
  Injector injector = Guice.createInjector(new GuiceModule())
  Application app = injector.getInstance(Application.class);
  app.run();
}

代码示例来源:origin: robeio/robe

@Override
public void run(String... args) throws Exception {
  if (args.length < 2) {
    LOGGER.error("Give a config yml path.");
  } else {
    configurationPath = args[1];
  }
  super.run(args);
}

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

@Override
public void run(String... arguments) throws Exception
{
  if ( arguments.length == 0 )
  {
    super.run(setSystemAndAdjustArgs(configFqpn));
  }
  else
  {
    super.run(arguments);
  }
}

代码示例来源:origin: org.sonatype.goodies.dropwizard/dropwizard-support-core

@Override
public final void run(final String... arguments) throws Exception {
 checkNotNull(arguments);
 // early verification that temporary directory is valid
 File tmpdir = resolveFile(System.getProperty("java.io.tmpdir"));
 try {
  Path tmp = Files.createTempFile(getName(), ".tmp");
  Files.delete(tmp);
 }
 catch (Throwable t) {
  Error fatal = new Error("Unable to create temporary file", t);
  System.err.printf("FATAL: %s; check that directory exists and is writable: %s%n", fatal.getMessage(), tmpdir);
  throw fatal;
 }
 Runtime.getRuntime().addShutdownHook(new Thread(this::onShutdown));
 super.run(arguments);
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws IOException {
  Weld weld = new Weld();
  WeldContainer container = weld.initialize();
  Application application = container.instance().select(Application.class).get();
  application.run();
  weld.shutdown();
}

相关文章