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


Java Application类代码示例

本文整理汇总了Java中io.dropwizard.Application的典型用法代码示例。如果您正苦于以下问题:Java Application类的具体用法?Java Application怎么用?Java Application使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Application类属于io.dropwizard包,在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newApplication

import io.dropwizard.Application; //导入依赖的package包/类
@Override public Application<ServerConfiguration> newApplication() {

              return new ServerMain("outland.feature.server") {

                @Override
                protected List<Module> addModules(
                    ServerConfiguration configuration, Environment environment) {
                  return Lists.newArrayList(
                      new ServerModule(configuration),
                      new HystrixModule(),
                      new RedisModule(configuration.redis),
                      new DynamoDbModule(configuration.aws),
                      new AuthModule(configuration.auth),
                      new TestFeatureServiceModule(),
                      new TestGroupModule()
                  );
                }
              };
            }
 
开发者ID:dehora,项目名称:outland,代码行数:20,代码来源:ServerSuite.java

示例2: renderReport

import io.dropwizard.Application; //导入依赖的package包/类
/**
 * Renders configuration tree report according to provided config.
 * By default report padded left with one tab. Subtrees are always padded with empty lines for better
 * visibility.
 *
 * @param config tree rendering config
 * @return rendered tree
 */
@Override
public String renderReport(final ContextTreeConfig config) {

    final Set<Class<?>> scopes = service.getActiveScopes();

    final TreeNode root = new TreeNode("APPLICATION");
    renderScopeContent(config, root, Application.class);

    renderSpecialScope(config, scopes, root, "BUNDLES LOOKUP", GuiceyBundleLookup.class);
    renderSpecialScope(config, scopes, root, "DROPWIZARD BUNDLES", Bundle.class);
    renderSpecialScope(config, scopes, root, "CLASSPATH SCAN", ClasspathScanner.class);

    final StringBuilder res = new StringBuilder().append(Reporter.NEWLINE).append(Reporter.NEWLINE);
    root.render(res);
    return res.toString();
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:25,代码来源:ContextTreeRenderer.java

示例3: processBundles

import io.dropwizard.Application; //导入依赖的package包/类
/**
 * Process initially registered and all transitive bundles.
 * <ul>
 * <li>Executing initial bundles (registered in {@link ru.vyarus.dropwizard.guice.GuiceBundle}
 * and by bundle lookup)</li>
 * <li>During execution bundles may register other bundles (through {@link GuiceyBootstrap})</li>
 * <li>Execute registered bundles and repeat from previous step until no new bundles registered</li>
 * </ul>
 * Bundles duplicates are checked by type: only one bundle instance may be registered.
 *
 * @param context       bundles context
 * @param configuration configuration object
 * @param environment   environment object
 * @param application   application instance
 */
public static void processBundles(final ConfigurationContext context,
                                  final Configuration configuration, final Environment environment,
                                  final Application application) {
    final List<GuiceyBundle> bundles = context.getBundles();
    final List<Class<? extends GuiceyBundle>> installedBundles = Lists.newArrayList();
    final GuiceyBootstrap guiceyBootstrap = new GuiceyBootstrap(
            context, bundles, configuration, environment, application);

    // iterating while no new bundles registered
    while (!bundles.isEmpty()) {
        final List<GuiceyBundle> processingBundles = Lists.newArrayList(BundleSupport.removeDuplicates(bundles));
        bundles.clear();
        for (GuiceyBundle bundle : removeTypes(processingBundles, installedBundles)) {

            final Class<? extends GuiceyBundle> bundleType = bundle.getClass();
            Preconditions.checkState(!installedBundles.contains(bundleType),
                    "State error: duplicate bundle '%s' registration", bundleType.getName());

            context.setScope(bundleType);
            bundle.initialize(guiceyBootstrap);
            installedBundles.add(bundleType);
            context.closeScope();
        }
    }
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:41,代码来源:BundleSupport.java

示例4: registerInjector

import io.dropwizard.Application; //导入依赖的package包/类
/**
 * Used internally to register application specific injector.
 *
 * @param application application instance
 * @param injector    injector instance
 * @return managed object, which must be registered to remove injector on application stop
 */
public static Managed registerInjector(final Application application, final Injector injector) {
    Preconditions.checkNotNull(application, "Application instance required");
    Preconditions.checkArgument(!INJECTORS.containsKey(application),
            "Injector already registered for application %s", application.getClass().getName());
    INJECTORS.put(application, injector);
    return new Managed() {
        @Override
        public void start() throws Exception {
            // not used
        }

        @Override
        public void stop() throws Exception {
            INJECTORS.remove(application);
        }
    };
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:25,代码来源:InjectorLookup.java

示例5: setup

import io.dropwizard.Application; //导入依赖的package包/类
public void setup(
        Class<? extends Application<TestConfiguration>> applicationClass,
        String configPath, ConfigOverride... configOverrides) {
    dropwizardTestSupport = new DropwizardTestSupport<>(applicationClass,
            ResourceHelpers.resourceFilePath(configPath), configOverrides);
    dropwizardTestSupport.before();
}
 
开发者ID:pac4j,项目名称:dropwizard-pac4j,代码行数:8,代码来源:AbstractApplicationTest.java

示例6: configure

import io.dropwizard.Application; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void configure() {
    bind(environment).to(Environment.class);
    bind(environment.healthChecks()).to(HealthCheckRegistry.class);
    bind(environment.lifecycle()).to(LifecycleEnvironment.class);
    bind(environment.metrics()).to(MetricRegistry.class);
    bind(environment.getValidator()).to(Validator.class);
    bind(configuration).to(bootstrap.getApplication().getConfigurationClass()).to(Configuration.class);
    bind(environment.getObjectMapper()).to(ObjectMapper.class);
    bind(bootstrap.getApplication()).to((Class) bootstrap.getApplication().getClass()).to(Application.class);
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:13,代码来源:EnvironmentBinder.java

示例7: configure

import io.dropwizard.Application; //导入依赖的package包/类
@Override
protected void configure() {
    bind(application);
    bind(application).to(Application.class);
    bind(environment);
    bind(environment.getObjectMapper());
    bind(environment.metrics());
    bind(environment.getValidator());
}
 
开发者ID:alex-shpak,项目名称:dropwizard-hk2bundle,代码行数:10,代码来源:HK2Bundle.java

示例8: TLSTruststoreTestCommand

import io.dropwizard.Application; //导入依赖的package包/类
public TLSTruststoreTestCommand(Application<T> application) {
    this(
            application,
            "truststoretest",
            "Runs GET request against HTTPS secured URL with provided truststore"
    );
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:8,代码来源:TLSTruststoreTestCommand.java

示例9: before

import io.dropwizard.Application; //导入依赖的package包/类
@Override
protected void before() throws Throwable {
  Application application = applicationClass.newInstance();
  Method method = applicationClass.getMethod("main", String[].class);
  String[] params = null;
  method.invoke(null, (Object) params);
}
 
开发者ID:rvs-fluid-it,项目名称:microservice-bundle,代码行数:8,代码来源:ApplicationRule.java

示例10: DropWizardServer

import io.dropwizard.Application; //导入依赖的package包/类
DropWizardServer(T builtConfig,
                 Bootstrap<T> bootstrap,
                 Application<T> application,
                 Environment environment,
                 Server jettyServer,
                 MetricRegistry metricRegistry) {
  this.builtConfig = builtConfig;
  this.bootstrap = bootstrap;
  this.application = application;
  this.environment = environment;
  this.jettyServer = jettyServer;
  this.metricRegistry = metricRegistry;
}
 
开发者ID:brandtg,项目名称:dropwizard-helix,代码行数:14,代码来源:DropWizardApplicationRunner.java

示例11: DropWizardServer

import io.dropwizard.Application; //导入依赖的package包/类
DropWizardServer(T builtConfig,
                 Bootstrap<T> bootstrap,
                 Application<T> application,
                 Environment environment,
                 Server jettyServer,
                 MetricRegistry metricRegistry)
{
  this.builtConfig = builtConfig;
  this.bootstrap = bootstrap;
  this.application = application;
  this.environment = environment;
  this.jettyServer = jettyServer;
  this.metricRegistry = metricRegistry;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:15,代码来源:DropWizardApplicationRunner.java

示例12: GuiceyBootstrap

import io.dropwizard.Application; //导入依赖的package包/类
public GuiceyBootstrap(final ConfigurationContext context, final List<GuiceyBundle> iterationBundles,
                       final Configuration configuration, final Environment environment,
                       final Application application) {
    this.context = context;
    this.iterationBundles = iterationBundles;
    this.configuration = configuration;
    this.environment = environment;
    this.application = application;
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:10,代码来源:GuiceyBootstrap.java

示例13: GuiceyAppRule

import io.dropwizard.Application; //导入依赖的package包/类
public GuiceyAppRule(final Class<? extends Application<C>> applicationClass,
                     @Nullable final String configPath,
                     final ConfigOverride... configOverrides) {
    this.applicationClass = applicationClass;
    this.configPath = configPath;
    for (ConfigOverride configOverride : configOverrides) {
        configOverride.addToSystemProperties();
    }
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:10,代码来源:GuiceyAppRule.java

示例14: newApplication

import io.dropwizard.Application; //导入依赖的package包/类
protected Application<C> newApplication() {
    try {
        return applicationClass.newInstance();
    } catch (Exception e) {
        throw new IllegalStateException("Failed to instantiate application", e);
    }
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:8,代码来源:GuiceyAppRule.java

示例15: AbstractAppTest

import io.dropwizard.Application; //导入依赖的package包/类
public AbstractAppTest(Class<? extends Application<C>> applicationClass, String configPath,
    ConfigOverride... configOverrides) {
  this.applicationClass = applicationClass;
  this.configPath = configPath;
  for (ConfigOverride configOverride : configOverrides) {
    configOverride.addToSystemProperties();
  }
}
 
开发者ID:openstack,项目名称:monasca-common,代码行数:9,代码来源:AbstractAppTest.java


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