本文整理了Java中io.dropwizard.setup.Bootstrap.getValidatorFactory()
方法的一些代码示例,展示了Bootstrap.getValidatorFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap.getValidatorFactory()
方法的具体详情如下:
包路径:io.dropwizard.setup.Bootstrap
类名称:Bootstrap
方法名:getValidatorFactory
[英]Returns the application's validator factory.
[中]
代码示例来源: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: 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: 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: 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: 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;
}
代码示例来源:origin: net.smartcosmos/smartcosmos-extension-api
@Override
public void initialize(Bootstrap<?> bootstrap)
{
ConfigurationFactory<T> cf = new DefaultConfigurationFactoryFactory<T>().create(extensionConfigurationClass,
bootstrap.getValidatorFactory().getValidator(),
bootstrap.getObjectMapper(),
"dw");
if (extensionConfigurationPath != null && !extensionConfigurationPath.isEmpty())
{
try
{
extensionConfiguration = (T) cf.build(bootstrap.getConfigurationSourceProvider(), extensionConfigurationPath);
initialize(extensionConfiguration);
} catch (Exception e)
{
handleInitializationException(e);
}
} else
{
throw new RuntimeException("Server extension " + name + " has no configuration.");
}
}
内容来源于网络,如有侵权,请联系作者删除!