當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。