Failing to inject Play's WSClient instance using injector

Viewed 711

I have a Class that has a WSClient dependancy injected:

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

and when running test and creating instance of MyApiService using 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 run to abort: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.NumberFormatException: format error 10000 at play.api.libs.ws.ahc.AsyncHttpClientProvider.(AhcWSModule.scala:40) at play.api.libs.ws.ahc.AsyncHttpClientProvider.class(AhcWSModule.scala:39) while locating play.api.libs.ws.ahc.AsyncHttpClientProvider while locating play.shaded.ahc.org. ... Caused by: java.lang.NumberFormatException: format error 10000

and in my application.cong I added:

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

tried to change to 60000 theres no difference...

using play 2.6.0 and scala 2.11.8

someone maybe know why is it failing?

thanks

2 Answers
Related