Class Environment

java.lang.Object
io.dropwizard.core.setup.Environment

public class Environment extends Object
A Dropwizard application's environment.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an environment with the system classloader, default object mapper, default validator factory, default health check registry, and default configuration for tests.
    Environment(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper, jakarta.validation.ValidatorFactory validatorFactory, com.codahale.metrics.MetricRegistry metricRegistry, @Nullable ClassLoader classLoader, com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, Configuration configuration)
    Creates a new environment.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the application's AdminEnvironment.
    io.dropwizard.jetty.MutableServletContextHandler
     
    io.dropwizard.jetty.MutableServletContextHandler
     
    Returns an ExecutorService to run time bound health checks
    @Nullable jakarta.servlet.Servlet
     
    Returns the application's name.
    com.fasterxml.jackson.databind.ObjectMapper
    Returns the application's ObjectMapper.
    jakarta.validation.Validator
    Returns the application's Validator.
    io.dropwizard.health.HealthEnvironment
    Returns the application's HealthEnvironment.
    com.codahale.metrics.health.HealthCheckRegistry
    Returns the application's HealthCheckRegistry.
    io.dropwizard.jersey.setup.JerseyEnvironment
    Returns the application's JerseyEnvironment.
    io.dropwizard.lifecycle.setup.LifecycleEnvironment
    Returns the application's LifecycleEnvironment.
    com.codahale.metrics.MetricRegistry
    Returns the application's MetricRegistry.
    io.dropwizard.jetty.setup.ServletEnvironment
    Returns the application's ServletEnvironment.
    void
    setValidator(jakarta.validation.Validator validator)
    Sets the application's Validator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Environment

      public Environment(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper, jakarta.validation.ValidatorFactory validatorFactory, com.codahale.metrics.MetricRegistry metricRegistry, @Nullable ClassLoader classLoader, com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, Configuration configuration)
      Creates a new environment.
      Parameters:
      name - the name of the application
      objectMapper - the ObjectMapper for the application
    • Environment

      public Environment(String name)
      Creates an environment with the system classloader, default object mapper, default validator factory, default health check registry, and default configuration for tests.
      Since:
      2.0
  • Method Details

    • jersey

      public io.dropwizard.jersey.setup.JerseyEnvironment jersey()
      Returns the application's JerseyEnvironment.
    • getHealthCheckExecutorService

      public ExecutorService getHealthCheckExecutorService()
      Returns an ExecutorService to run time bound health checks
    • admin

      public AdminEnvironment admin()
      Returns the application's AdminEnvironment.
    • lifecycle

      public io.dropwizard.lifecycle.setup.LifecycleEnvironment lifecycle()
      Returns the application's LifecycleEnvironment.
    • servlets

      public io.dropwizard.jetty.setup.ServletEnvironment servlets()
      Returns the application's ServletEnvironment.
    • health

      public io.dropwizard.health.HealthEnvironment health()
      Returns the application's HealthEnvironment.
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Returns the application's ObjectMapper.
    • getName

      public String getName()
      Returns the application's name.
    • getValidator

      public jakarta.validation.Validator getValidator()
      Returns the application's Validator.
    • setValidator

      public void setValidator(jakarta.validation.Validator validator)
      Sets the application's Validator.
    • metrics

      public com.codahale.metrics.MetricRegistry metrics()
      Returns the application's MetricRegistry.
    • healthChecks

      public com.codahale.metrics.health.HealthCheckRegistry healthChecks()
      Returns the application's HealthCheckRegistry.
    • getApplicationContext

      public io.dropwizard.jetty.MutableServletContextHandler getApplicationContext()
    • getJerseyServletContainer

      public @Nullable jakarta.servlet.Servlet getJerseyServletContainer()
    • getAdminContext

      public io.dropwizard.jetty.MutableServletContextHandler getAdminContext()