Error in the introduction. Playing an instance of WSClient using an injector

I have a class that has a dependent WSClient dependency:

@Singleton
class MyApiService @Inject() (wsclient: WSClient, conf: Configuration) {
...
}

and when running the test and instantiating MyApiService using the injector:

class MyTest extends FreeSpec with OneAppPerSuite with ScalaFutures with WsScalaTestClient {

  implicit lazy val materializer: Materializer = app.materializer

  lazy val wsc: WSClient = app.injector.instanceOf[WSClient]
  lazy val conf: Configuration = app.injector.instanceOf[Configuration]

  val myApiService: MyApiService = app.injector.instanceOf[MyApiService]

  "Api Test" in {
    ...
  }

I get this error:

An exception or error caused a stop: cannot be executed, see the following errors:

     

1) Input error constructor, java.lang.NumberFormatException: format error 10000 with. Play.api.libs.ws.ahc.AsyncHttpClientProvider (AhcWSModule.scala: 40) in play.api.libs.ws.ahc.AsyncHttpClientProvider.class (AhcWSModule.scala: 39) when searching for play.api.libs.ws.ahc .AsyncHttpClientProvider while searching play.shaded.ahc.org .... Called: java.lang.NumberFormatException: format error 10000

and in mine application.congI added:

  ws.timeout.connection = 10000
  ws.timeout.idle = 10000
  ws.timeout.request = 10000

60000 ...

play 2.6.0 scala 2.11.8

- , ?

+4
2

. ws.timeout.

Play 2.6 .

WSConfigParser scala.concurrent.Duration . , .

, ms1000ms

application.conf

play {
  ws {
    timeout {
      connection: 10000ms
      idle: 30000ms
      request: 60000ms
    }
  }
}
+1

Source: https://habr.com/ru/post/1681300/


All Articles