我正在尝试将CORS过滤器添加到我的Play Framework REST API中.我添加了一个Filters类,根据
documentation,但它似乎无法找到以下包,我搜索高低,没有运气:
import play.filters.cors.CORSFilter;
而Filter类:
import play.api.mvc.EssentialFilter;
import play.filters.cors.CORSFilter;
import play.http.HttpFilters;
import javax.inject.Inject;
public class Filters implements HttpFilters {
@Inject
CORSFilter corsFilter;
public EssentialFilter[] filters() {
return new EssentialFilter[] { corsFilter };
}
}
build.sbt:
libraryDependencies ++= Seq(
javaJpa,
filters,
"org.hibernate" % "hibernate-entitymanager" % "4.3.7.Final",
"org.projectlombok" % "lombok-maven" % "1.16.6.1",
"org.postgresql" % "postgresql" % "9.4.1207.jre7",
"org.springframework.data" % "spring-data-jpa" % "1.9.2.RELEASE",
"org.mindrot" % "jbcrypt" % "0.3m"
)
这个包裹在哪里?
最佳答案 在终端中使用activator eclipse命令就像激活器运行一样.
它解决了我的问题,希望它也适合你.