T
- the configuration typepublic class Bootstrap<T extends Configuration>
extends java.lang.Object
Constructor | Description |
---|---|
Bootstrap(Application<T> application) |
Creates a new
Bootstrap for the given application. |
Modifier and Type | Method | Description |
---|---|---|
void |
addBundle(Bundle bundle) |
Adds the given bundle to the bootstrap.
|
void |
addBundle(ConfiguredBundle<? super T> bundle) |
Adds the given bundle to the bootstrap.
|
void |
addCommand(Command command) |
Adds the given command to the bootstrap.
|
void |
addCommand(ConfiguredCommand<T> command) |
Adds the given command to the bootstrap.
|
Application<T> |
getApplication() |
Returns the bootstrap's
Application . |
java.lang.ClassLoader |
getClassLoader() |
Returns the bootstrap's class loader.
|
com.google.common.collect.ImmutableList<Command> |
getCommands() |
Returns the application's commands.
|
io.dropwizard.configuration.ConfigurationFactoryFactory<T> |
getConfigurationFactoryFactory() |
|
io.dropwizard.configuration.ConfigurationSourceProvider |
getConfigurationSourceProvider() |
Returns the bootstrap's
ConfigurationSourceProvider . |
com.codahale.metrics.health.HealthCheckRegistry |
getHealthCheckRegistry() |
returns the health check registry
|
com.codahale.metrics.MetricRegistry |
getMetricRegistry() |
Returns the application metrics.
|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
Returns the bootstrap's
ObjectMapper . |
javax.validation.ValidatorFactory |
getValidatorFactory() |
Returns the application's validator factory.
|
void |
registerMetrics() |
Registers the JVM metrics to the metric registry and start to report
the registry metrics via JMX.
|
void |
run(T configuration,
Environment environment) |
Runs the bootstrap's bundles with the given configuration and environment.
|
void |
setClassLoader(java.lang.ClassLoader classLoader) |
Sets the bootstrap's class loader.
|
void |
setConfigurationFactoryFactory(io.dropwizard.configuration.ConfigurationFactoryFactory<T> configurationFactoryFactory) |
|
void |
setConfigurationSourceProvider(io.dropwizard.configuration.ConfigurationSourceProvider provider) |
Sets the bootstrap's
ConfigurationSourceProvider . |
void |
setHealthCheckRegistry(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry) |
|
void |
setMetricRegistry(com.codahale.metrics.MetricRegistry metricRegistry) |
Sets a custom registry for the application metrics.
|
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
Sets the given
ObjectMapper to the bootstrap. |
void |
setValidatorFactory(javax.validation.ValidatorFactory validatorFactory) |
public Bootstrap(Application<T> application)
Bootstrap
for the given application.application
- a Dropwizard Application
public void registerMetrics()
public Application<T> getApplication()
Application
.public io.dropwizard.configuration.ConfigurationSourceProvider getConfigurationSourceProvider()
ConfigurationSourceProvider
.public void setConfigurationSourceProvider(io.dropwizard.configuration.ConfigurationSourceProvider provider)
ConfigurationSourceProvider
.public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader classLoader)
public void addBundle(Bundle bundle)
bundle
- a Bundle
public void addBundle(ConfiguredBundle<? super T> bundle)
bundle
- a ConfiguredBundle
public void addCommand(Command command)
command
- a Command
public void addCommand(ConfiguredCommand<T> command)
command
- a ConfiguredCommand
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
ObjectMapper
.public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
ObjectMapper
to the bootstrap.
WARNING: The mapper should be created by Jackson.newMinimalObjectMapper()
or Jackson.newObjectMapper()
, otherwise it will not work with Dropwizard.
objectMapper
- an ObjectMapper
public void run(T configuration, Environment environment) throws java.lang.Exception
configuration
- the parsed configurationenvironment
- the application environmentjava.lang.Exception
- if a bundle throws an exceptionpublic com.google.common.collect.ImmutableList<Command> getCommands()
public com.codahale.metrics.MetricRegistry getMetricRegistry()
public void setMetricRegistry(com.codahale.metrics.MetricRegistry metricRegistry)
metricRegistry
- a custom metric registrypublic javax.validation.ValidatorFactory getValidatorFactory()
public void setValidatorFactory(javax.validation.ValidatorFactory validatorFactory)
public io.dropwizard.configuration.ConfigurationFactoryFactory<T> getConfigurationFactoryFactory()
public void setConfigurationFactoryFactory(io.dropwizard.configuration.ConfigurationFactoryFactory<T> configurationFactoryFactory)
public com.codahale.metrics.health.HealthCheckRegistry getHealthCheckRegistry()
public void setHealthCheckRegistry(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry)
Copyright © 2018. All rights reserved.