1
我正在使用Scala播放框架2.5,我想使用依赖注入将WSClient的一个实例注入到我的自定义类中,但我不断收到以下错误。ScalaWS在播放框架2.5和WSClient在自定义类中的依赖注入
not enough arguments for constructor TestClass: (ws: play.api.libs.ws.WSClient)service.TestClass. Unspecified value parameter ws.
我运行下面的代码时出现错误
class TestClass @Inject() (ws: WSClient) {
def doSomething() : Future[WSResponse] = {
ws.url("http://www.google.com").get()
}
}
val test = new TestClass()
val f = test.doSomething()
val result = Await.result(f, Duration.Inf)
println("doSomething: " + result)
有人可以帮我解决的努力注入wsclient依赖到自定义类这个问题?
请多关照
弗朗西斯