Say I have a play application
class AppLoader extends ApplicationLoader {
override def load(context: Context): Application =
new BuiltInComponentsFromContext(context) with AhcWSComponents { }.application
}
And I'm trying to run it in an integration test with some layouts for testing. My current (doesn't work) approach:
lazy val app: Application = {
val customContext = ApplicationLoader.createContext(Environment.simple(new java.io.File("."), Mode.Test))
new AppLoader().load(customContext)
}
Play.start(app)
But the http server is not running, all my requests are denied using java.net.ConnectException: Connection refused (Connection refused).
Is there a way to run the application without magic?
source
share