Closed will-r closed 7 years ago
That is one possible approach, another would be is to make the injected application implicit
import play.api.Application
class MyController @Inject()(implicit val application: Application) extends Controller {
val bucket = S3("my-bucket")
}
or build it with a client and configuration
import play.api.Configuration
import play.api.libs.ws.WSClient
class MyController @Inject()(client: WSClient, configuration: Configuration) extends Controller {
val bucket = S3.fromConfiguration(client, configuration).getBucket("my-bucket")
}
I will update the README accordingly
Oh, haha @Hayena, did not see your response.
@EECOLOR that's fine, you made a similar alteration as I was planning ;)
Thank you very much for the quick response. I'm using an injected WSClient and all is well.
The README example seems not to be up to date with Play 2.5. Calling
S3(bucket_name)
throws a 'no implicit application in scope' error. Instead I'm calling it like this, which seems to work:Is this broadly right, and if not could you possibly update the example?