2

What is the difference between the following libraries:

libraryDependencies += "com.typesafe.play" %% "play-ahc-ws-standalone" % "LATEST_VERSION"

and

libraryDependencies += "com.typesafe.play" %% "play-ahc-ws" % "LATEST_VERSION"

I am just trying to figure which is the correct one to use. What I did was to create a Play module in a separate library and I want to inject that into a Play application. But when I used the first library listed above, it only offers a StandaloneWSClient. When I injected that into a Play application it couldn't bind an implementation to it. But when I switched the second library, it offers a WSClient which the Play application could find an implementation to bind to as it already has one which you can specify in the build.sbt definition ie ws.

Mario Galic
  • 47,285
  • 6
  • 56
  • 98
Mojo
  • 1,152
  • 1
  • 8
  • 16

1 Answers1

2

Within Play project you should use play-ahc-ws which is usually added like so

libraryDependencies += ws

The ws value comes from Play's sbt plugin

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.1")

On the other hand, play-ahc-ws-standalone is a HTTP client in its own right which can be used outside Play projects, just how one could use, for example, scalaj-http or requests-scala HTTP clients which are in no way aware of Play.

The difference is documented by Play 2.6 Migration Guide.

Mario Galic
  • 47,285
  • 6
  • 56
  • 98