Package play

Class ApplicationLoader.Context

java.lang.Object
play.ApplicationLoader.Context
Enclosing interface:
ApplicationLoader

public static final class ApplicationLoader.Context extends Object
The context for loading an application.
  • Constructor Details

    • Context

      public Context(play.api.ApplicationLoader.Context underlying)
      The context for loading an application.
      Parameters:
      underlying - The Scala context that is being wrapped.
    • Context

      public Context(Environment environment)
      The context for loading an application.
      Parameters:
      environment - the application environment
    • Context

      public Context(Environment environment, Map<String,Object> initialSettings)
      The context for loading an application.
      Parameters:
      environment - the application environment
      initialSettings - the initial settings. These settings are merged with the settings from the loaded configuration files, and together form the initialConfiguration provided by the context. It is intended for use in dev mode, to allow the build system to pass additional configuration into the application.
  • Method Details

    • asScala

      public play.api.ApplicationLoader.Context asScala()
      Get the wrapped Scala context.
      Returns:
      the wrapped scala context
    • environment

      public Environment environment()
      Get the environment from the context.
      Returns:
      the environment
    • initialConfig

      public com.typesafe.config.Config initialConfig()
      Get the configuration from the context. This configuration is not necessarily the same configuration used by the application, as the ApplicationLoader may, through it's own mechanisms, modify it or completely ignore it.
      Returns:
      the initial configuration
    • applicationLifecycle

      public ApplicationLifecycle applicationLifecycle()
      Get the application lifecycle from the context.
      Returns:
      the application lifecycle
    • devContext

      public Optional<play.api.ApplicationLoader.DevContext> devContext()
      If an application is loaded in dev mode then this additional context is available.
      Returns:
      optional with the value if the application is running in dev mode or empty otherwise.
    • sourceMapper

      @Deprecated public Optional<play.core.SourceMapper> sourceMapper()
      Deprecated.
      Deprecated as of 2.7.0. Access it using devContext().
      Get the source mapper from the context.
      Returns:
      an optional source mapper
    • withEnvironment

      public ApplicationLoader.Context withEnvironment(Environment environment)
      Create a new context with a different environment.
      Parameters:
      environment - the environment this context should use
      Returns:
      a context using the specified environment
    • withConfig

      public ApplicationLoader.Context withConfig(com.typesafe.config.Config initialConfiguration)
      Create a new context with a different configuration.
      Parameters:
      initialConfiguration - the configuration to use in the created context
      Returns:
      the created context