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

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

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

Bootstrap.setConfigurationFactoryFactory介绍

暂无

代码示例

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

bootstrap.setConfigurationFactoryFactory((klass, validator, objectMapper, propertyPrefix) ->
    new POJOConfigurationFactory<>(getConfiguration()));
} else if (customPropertyPrefix.isPresent()) {
  bootstrap.setConfigurationFactoryFactory((klass, validator, objectMapper, propertyPrefix) ->
    new YamlConfigurationFactory<>(klass, validator, objectMapper, customPropertyPrefix.get()));

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

@Override
public void initialize(Bootstrap<?> bootstrap)
{
  final InjectableValues injectableValues = new InjectableValues()
  {
    @Override
    public Object findInjectableValue(Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance)
    {
      return null;
    }
  };
  final ConfigurationFactoryFactory<? extends Configuration> configurationFactoryFactory = bootstrap.getConfigurationFactoryFactory();
  ConfigurationFactoryFactory factoryFactory = new ConfigurationFactoryFactory()
  {
    @Override
    public ConfigurationFactory create(Class klass, Validator validator, ObjectMapper objectMapper, String propertyPrefix)
    {
      objectMapper.setInjectableValues(injectableValues);
      //noinspection unchecked
      return configurationFactoryFactory.create(klass, validator, objectMapper, propertyPrefix);
    }
  };
  //noinspection unchecked
  bootstrap.setConfigurationFactoryFactory(factoryFactory);
}

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

bootstrap.setConfigurationFactoryFactory((klass, validator, objectMapper, propertyPrefix) ->
    new POJOConfigurationFactory<>(getConfiguration()));
} else if (customPropertyPrefix.isPresent()) {
  bootstrap.setConfigurationFactoryFactory((klass, validator, objectMapper, propertyPrefix) ->
    new YamlConfigurationFactory<>(klass, validator, objectMapper, customPropertyPrefix.get()));

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

@Override
public void initialize(Bootstrap<C> bootstrap) {
  if (configurationBridge != null) {
    bootstrap.setConfigurationFactoryFactory(new BridgedConfigurationFactoryFactory<C>(configurationBridge));
  }
  // Swaps the default FileConfigurationSourceProvider
  bootstrap.setConfigurationSourceProvider(new ClasspathConfigurationSourceProvider());
  dropwizardApplication.initialize(bootstrap);
}

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

@Override
public final void initialize(Bootstrap<T> bootstrap)
{
  bootstrap.setConfigurationFactoryFactory(builder.getFactoryFactory());
  bootstrap.setConfigurationSourceProvider(new FlexibleConfigurationSourceProvider());
  ConfiguredBundle<T> bundle = new ConfiguredBundle<T>()
  {
    @Override
    public void run(T configuration, Environment environment) throws Exception
    {
      DefaultServerFactory factory = new DefaultServerFactory();
      factory.setAdminConnectors(Lists.<ConnectorFactory>newArrayList());
      configuration.setServerFactory(factory);
    }
    @Override
    public void initialize(Bootstrap<?> bootstrap)
    {
      // NOP
    }
  };
  addBundles(bootstrap, BundleSpec.Phase.PRE_SOA);
  bootstrap.addBundle(bundle);
  bootstrap.addBundle(new SoaBundle<>());
  bootstrap.addBundle(new ComponentBundle(builder.getAppName(), builder.getCompanyName(), builder.getFooterMessage(), builder.getTabs(), builder.getMetrics(), builder.getAuthSpec()));
  bootstrap.addBundle(new AssetsBundle("/assets/soa"));
  addBundles(bootstrap, BundleSpec.Phase.POST_SOA);
}

相关文章