logo
down
shadow

Set Play Framework Environment


Set Play Framework Environment

By : Naive D Jack
Date : November 22 2020, 09:00 AM
will help you As I understand it, what you observe is the correct behavior of Play 2.4
In dev mode, 404 are handled by the devNotFound.scala.html template and yield errors which look like :
code :


Share : facebook icon twitter icon
how to set global environment variable for Play 2.0 Framework?

how to set global environment variable for Play 2.0 Framework?


By : poland
Date : March 29 2020, 07:55 AM
should help you out I don't think Play 2.0 impose a variable name. I suggest the classic convention "PLAY2_HOME", pointing to your play installation directory. In order to use Play from any console location, you also have to update your PATH variable (adding %PLAY2_HOME%)
Play Framework 2.5.x: Inject Environment in a Module

Play Framework 2.5.x: Inject Environment in a Module


By : Bra H
Date : March 29 2020, 07:55 AM
To fix this issue I will rewrite your code to remove a small possible confusion here. This is exactly your code with a small rename of the type parameters:
code :
import javax.inject.Inject
import play.api.Logger
import play.api.Environment
import play.api.Configuration
import com.google.inject.AbstractModule

trait MyInit[T] {
  val env: T
}

class MyInitClass[T] @Inject() (val env: T) extends MyInit[T] {
  initializeDB()

  def initializeDB() = {
    Logger.info("MyINIT: Creating database...")
    MyDBService.createDatabase()
    Logger.info("MyINIT: Creating tables...")
    MyDBService.createTables()
  }
}
import com.google.inject.AbstractModule
import play.api.{Configuration, Environment, Mode}

class DatabaseInitializerModule(
  environment: Environment,
  configuration: Configuration
) extends AbstractModule {

  def configure() = {
    environment.mode match {
      case Mode.Dev =>
        // Start dev database
      case Mode.Test =>
        // Start test database
      case Mode.Prod =>
        // Start prod database
    }
  }
}
import javax.inject.Inject

import play.api.{Environment, Mode}
import com.google.inject.AbstractModule

class DatabaseInitializer @Inject()(environment: Environment) {
  environment.mode match {
    case Mode.Dev =>
    // Start dev database
    case Mode.Test =>
    // Start test database
    case Mode.Prod =>
    // Start prod database
  }
}

class DatabaseInitializerModule extends AbstractModule {
  override def configure() = {
    bind(classOf[DatabaseInitializer]).asEagerSingleton()
  }
}
Adding an environment variable for the Play! Framework

Adding an environment variable for the Play! Framework


By : Jade
Date : March 29 2020, 07:55 AM
help you fix your problem If you want to call play from anywhere, you should add it to the end of Windows' System variable: Path
The path variable is in the same place you add your system environment variable.
Play Framework: Set environment for Integration test

Play Framework: Set environment for Integration test


By : Chris
Date : March 29 2020, 07:55 AM
wish of those help My understanding is that tests run in forked JVM and that's why the property is not set. You may pass the "env" parameter by adding following to your build.sbt:
setting up environment variables in Play! framework

setting up environment variables in Play! framework


By : ku lu
Date : March 29 2020, 07:55 AM
With these it helps In Play 2.3+ play command is replaced by activator.
More details in What's new in Play 2.3 doc
Related Posts Related Posts :
  • Play too many arguments for method Apply
  • How to solve transitive dependencies version conflicts (scala/sbt)
  • Writing DataFrame to MemSQL Table in Spark
  • How to add columns into org.apache.spark.sql.Row inside of mapPartitions
  • Either[A, Future[B]] to Future[Either[A, B]]
  • store a bunch of configuration information in scala
  • Spark: How to transform LabeledPoint features values from int to 0/1?
  • How to get input from Scala after a certain point in time?
  • Where do I put my tests when I split my Play project into sub modules
  • Read Array in sub queries spark sql using scala
  • Scala map with implicit conversion
  • Spark, Scala, DataFrame: create feature vectors
  • Scala Enumeration: Choose some values as type
  • How can I create a Spark DataFrame from a nested array of struct element?
  • why scala lambda with _ can't using && to combine two bool expression
  • Return elements from array, except for repeating
  • Heroku: deploy Spray based service
  • Mass-add an object if it is an instance of a class
  • Automatically convert a case class to an extensible record in shapeless?
  • How to use pipeTo in AKKA correctly
  • Define a common trait for types with different numbers of type parameters
  • RDD Persistence in Spark
  • Scala trait as a method input - type mismatch error
  • Scala compiler optimization for immutability
  • Base class reference in Scala
  • Akka: The order of responses
  • Why does enablePlugins(DockerPlugin) from sbt-docker in Play project give "error: reference to DockerPlugin is ambi
  • Convert a scala list of Strings into a list of Doubles while discarding unconvertable strings
  • Change the contents of a file in scala
  • Akka Actor testing with ScalaTest using Testkit EventListeners
  • Prepare data for MultilayerPerceptronClassifier in scala
  • Immutability and custom deserialization in Scala
  • Play Framework dependency injection Object vs @Singleton Class
  • Slick 3 transaction how to
  • When should avoid usage of Future in scala
  • Which Spark operation returns the elements not matched by a join?
  • How to group incoming events from infinite stream?
  • Converting a List to a Case Class
  • Get names of the variables in an object
  • Generics re: Scala.math.Ordering wrapper instance for java.lang.Comparable
  • implicit Impl method for collections in scala breeze
  • How to have colored REPL for 'sbt console'?
  • Using the squants library, how do I specify a specific unit of measure for a method?
  • Play Framework: Gzip compression/decompression of data over WebSocket
  • Why does mapPartitions print nothing to stdout?
  • Call doAnswer with function as argument in scala play 2.4
  • Get or create child actor by ID
  • Why substracting two Dates gives me an extra hour?
  • Akka, advices on implementation
  • Spark Scala 2.10 tuple limit
  • Scala currying and type inference
  • Spark DataFrame filtering: retain element belonging to a list
  • Scala/IntelliJ: case object X vs case class X vs case class X()
  • Scala performance with functional constructs
  • StringOrInt from Idris -> Scala?
  • Implement generics in trait and method
  • Spray Routing Doesn't match anything
  • Learning Scala without Java
  • Does Akka clustering (2.4) use any ports by default other than 2551?
  • How to enrich a Java library class that has static methods (aka enrich an object in Scala)?
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co