我无法在Playframework 2.3.0中导入过滤器 [英] I can not import filters in playframework 2.3.0
问题描述
我使用playframework 2.3.0,最近我想添加CSRFFilter
I use playframework 2.3.0, recently I want to add the CSRFFilter
当我在global.scala中导入csrf时:
when I import csrf in global.scala:
import play.filters.csrf._
我为此报错:
[错误] G:\ testprojects \ app \ Global.scala:7:对象过滤器不是成员 打包游戏 [错误]导入play.filters.csrf._
[error] G:\testprojects\app\Global.scala:7: object filters is not a member of package play [error] import play.filters.csrf._
我的plugin.sbt是
My plugin.sbt is
...
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.0")
...
我使用Build.scala而不是build.sbt
I use Build.scala instead of build.sbt
lazy val root = Project("root", base = file(".")).enablePlugins(PlayScala)
.settings(baseSettings: _*)
.settings(libraryDependencies++=appDependencies)
.settings(
scalaVersion := "2.11.1",
version := "1.0"
)
推荐答案
根据文档必须将过滤器依赖项添加到您的项目中:
According to the documentation you have to add the filters dependency to your project:
libraryDependencies += filters
该文档适用于build.sbt,但我想它也应与Build.scala一起使用.
The documentation is for build.sbt but I guess it should work with Build.scala too.
这篇关于我无法在Playframework 2.3.0中导入过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!