Class Bootstrap<T extends Configuration>

  • Type Parameters:
    T - the configuration type

    public class Bootstrap<T extends Configuration>
    extends Object
    The pre-start application environment, containing everything required to bootstrap a Dropwizard command.
    • Constructor Detail

      • Bootstrap

        public Bootstrap​(Application<T> application)
        Creates a new Bootstrap for the given application.
        Parameters:
        application - a Dropwizard Application
    • Method Detail

      • registerMetrics

        public void registerMetrics()
        Registers the JVM metrics to the metric registry and start to report the registry metrics via JMX.
      • getJmxReporter

        public @Nullable com.codahale.metrics.jmx.JmxReporter getJmxReporter()
        Returns the JmxReporter registered with the bootstrap's MetricRegistry.
        Since:
        2.1
      • getClassLoader

        public ClassLoader getClassLoader()
        Returns the bootstrap's class loader.
      • setClassLoader

        public void setClassLoader​(ClassLoader classLoader)
        Sets the bootstrap's class loader.
      • addCommand

        public void addCommand​(Command command)
        Adds the given command to the bootstrap.
        Parameters:
        command - a Command
      • getObjectMapper

        public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
        Returns the bootstrap's ObjectMapper.
      • setObjectMapper

        public void setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Sets the given ObjectMapper to the bootstrap. WARNING: The mapper should be created by Jackson.newMinimalObjectMapper() or Jackson.newObjectMapper(), otherwise it will not work with Dropwizard.

        Parameters:
        objectMapper - an ObjectMapper
      • run

        public void run​(T configuration,
                        Environment environment)
                 throws Exception
        Runs the bootstrap's bundles with the given configuration and environment.
        Parameters:
        configuration - the parsed configuration
        environment - the application environment
        Throws:
        Exception - if a bundle throws an exception
      • getCommands

        public List<Command> getCommands()
        Returns the application's commands.
      • getMetricRegistry

        public com.codahale.metrics.MetricRegistry getMetricRegistry()
        Returns the application metrics.
      • setMetricRegistry

        public void setMetricRegistry​(com.codahale.metrics.MetricRegistry metricRegistry)
        Sets a custom registry for the application metrics.
        Parameters:
        metricRegistry - a custom metric registry
      • getValidatorFactory

        public jakarta.validation.ValidatorFactory getValidatorFactory()
        Returns the application's validator factory.
      • setValidatorFactory

        public void setValidatorFactory​(jakarta.validation.ValidatorFactory validatorFactory)
      • setConfigurationFactoryFactory

        public void setConfigurationFactoryFactory​(ConfigurationFactoryFactory<T> configurationFactoryFactory)
      • getHealthCheckRegistry

        public com.codahale.metrics.health.HealthCheckRegistry getHealthCheckRegistry()
        returns the health check registry
      • setHealthCheckRegistry

        public void setHealthCheckRegistry​(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry)