我无法在play framework 2.3.7中导入过滤器

时间:2014-12-05 14:47:54

标签: java playframework playframework-2.3

我在scala语言中看到了同样的问题,但它对我的问题没有帮助。 I can not import filters in playframework 2.3.0

我想添加CSRFFilter,但我无法导入play.filters.csrf。*;,项目没有看到这个类。

Global.java

import play.GlobalSettings;
import play.api.mvc.EssentialFilter;
import play.filters.csrf.*;

public class Global extends GlobalSettings {
    public <T extends EssentialFilter> Class<T>[] filters() {
        return new Class[] { CSRFFilter.class };
    }
}

build.sbt

name := """AppName"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  "mysql" % "mysql-connector-java" % "5.1.18",
  filters,
  javaJdbc,
  javaEbean,
  cache,
  javaWs
)

和plugins.sbt

resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

提前感谢您的帮助。

0 个答案:

没有答案