Package play
Class ApplicationLoader.Context
java.lang.Object
play.ApplicationLoader.Context
- Enclosing interface:
- ApplicationLoader
The context for loading an application.
-
Constructor Summary
ConstructorsConstructorDescriptionContext(play.api.ApplicationLoader.Context underlying) The context for loading an application.Context(Environment environment) The context for loading an application.Context(Environment environment, Map<String, Object> initialSettings) The context for loading an application. -
Method Summary
Modifier and TypeMethodDescriptionGet the application lifecycle from the context.play.api.ApplicationLoader.ContextasScala()Get the wrapped Scala context.Optional<play.api.ApplicationLoader.DevContext>If an application is loaded in dev mode then this additional context is available.Get the environment from the context.com.typesafe.config.ConfigGet the configuration from the context.Optional<play.core.SourceMapper>Deprecated.Deprecated as of 2.7.0.withConfig(com.typesafe.config.Config initialConfiguration) Create a new context with a different configuration.withEnvironment(Environment environment) Create a new context with a different environment.
-
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
The context for loading an application.- Parameters:
environment- the application environment
-
Context
The context for loading an application.- Parameters:
environment- the application environmentinitialSettings- 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
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
Get the application lifecycle from the context.- Returns:
- the application lifecycle
-
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.Deprecated as of 2.7.0. Access it usingdevContext().Get the source mapper from the context.- Returns:
- an optional source mapper
-
withEnvironment
Create a new context with a different environment.- Parameters:
environment- the environment this context should use- Returns:
- a context using the specified environment
-
withConfig
Create a new context with a different configuration.- Parameters:
initialConfiguration- the configuration to use in the created context- Returns:
- the created context
-