0
私は、上記のhereのようにcache-annotations-ri-guiceをプラグインしようとしています。 descriptionが見つかりました。しかし、それは動作しません。 私のテストプロジェクトは次のようになりますguiceのplayframeworkのキャッシュアノテーション
public class HomeController extends Controller {
public Result index() {
return ok(getString("qwe"));
}
@CacheResult
private String getString(String str) {
Random r = new Random();
return "HelloWorld " + str + r.nextInt();
}
}
この呼び出しは毎回異なる値を返します。
build.sbt:
name := """myann"""
organization := "com.example"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayNettyServer, LauncherJarPlugin)
.disablePlugins(PlayAkkaHttpServer)
.settings(libraryDependencies ++= Seq(
guice,
jcache,
ehcache,
"org.jsr107.ri" % "cache-annotations-ri-guice" % "1.0.0"
))
scalaVersion := "2.12.2"
Module.java:
public class Module extends AbstractModule {
@Override
public void configure() {
install(new CacheAnnotationsModule());
}
}
私の環境: addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.3") sbt.version=0.13.15
それは定期的に操作できるようにする方法?