本文整理了Java中io.dropwizard.setup.Bootstrap.getConfigurationFactoryFactory()
方法的一些代码示例,展示了Bootstrap.getConfigurationFactoryFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap.getConfigurationFactoryFactory()
方法的具体详情如下:
包路径:io.dropwizard.setup.Bootstrap
类名称:Bootstrap
方法名:getConfigurationFactoryFactory
暂无
代码示例来源:origin: dropwizard/dropwizard
@Override
@SuppressWarnings("unchecked")
public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception {
final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap;
configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(),
bootstrap.getConfigurationSourceProvider(),
bootstrap.getValidatorFactory().getValidator(),
namespace.getString("file"),
getConfigurationClass(),
bootstrap.getObjectMapper());
try {
if (configuration != null) {
configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(),
bootstrap.getApplication().getName());
}
run(bootstrap, namespace, configuration);
} finally {
if (!asynchronous) {
cleanup();
}
}
}
代码示例来源:origin: io.dropwizard/dropwizard-core
@Override
@SuppressWarnings("unchecked")
public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception {
final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap;
configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(),
bootstrap.getConfigurationSourceProvider(),
bootstrap.getValidatorFactory().getValidator(),
namespace.getString("file"),
getConfigurationClass(),
bootstrap.getObjectMapper());
try {
if (configuration != null) {
configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(),
bootstrap.getApplication().getName());
}
run(bootstrap, namespace, configuration);
} finally {
if (!asynchronous) {
cleanup();
}
}
}
代码示例来源: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: robeio/robe
protected T loadConfiguration(Bootstrap bootstrap) {
if (config == null) {
try {
config = (T) bootstrap.getConfigurationFactoryFactory().create(
bootstrap.getApplication().getConfigurationClass(),
bootstrap.getValidatorFactory().getValidator(),
bootstrap.getObjectMapper(), "")
.build(new File(configurationPath));
} catch (Exception e) {
throw new RobeRuntimeException("Can't load configuration :" + configurationPath, e);
}
}
return config;
}
内容来源于网络,如有侵权,请联系作者删除!