我需要在HTML响应中执行JavaScript。我使用的是sttp版本1.5.12。根据文档,我只需要包括implicit val sttpBackend = FetchBackend(),但它不起作用。见以下文档:https://sttp.readthedocs.io/en/latest/backends/javascript/fetch.html
已经包含了Maven的依赖项。
<!-- https://mvnrepository.com/artifact/com.softwaremill.sttp/core -->
<dependency>
<groupId>com.softwaremill.sttp</groupId>
<artifactId>core_2.12</artifactId>
<version>1.5.12</version>
</dependency>示例:
import com.softwaremill.sttp._
implicit val sttpBackend = FetchBackend()我希望像其他支持的后端一样使用这个。Eclipse报告not found : value FetchBackend
任何帮助都是非常感谢的。
发布于 2019-04-17 14:20:20
FetchBackend是取api (浏览器API )的包装器。您只能在scala中使用它。如果打开链接,您会注意到sttp在sbt DSL中的依赖使用了三个%,这意味着它是为scala编译的版本:
"com.softwaremill.sttp" %%% "core" % "1.5.12"使用maven依赖项,您将引用sstp的jvm版本,它不包含scala特定的后端。
您必须为jvm使用另一个后端,如akka-http-后端。
https://stackoverflow.com/questions/55728852
复制相似问题