任何人都可以使用aspectj提供一些瘦的Scala完整示例吗? 插件,build.sbt等..
我已将以下内容添加到plugins.sbt:
addSbtPlugin("com.lightbend.sbt" % "sbt-aspectj" % "0.11.0")
以及build.sbt的以下内容:
libraryDependencies ++= List(
"org.aspectj" % "aspectjweaver" % "1.8.13",
"org.aspectj" % "aspectjrt" % "1.8.13")
import com.lightbend.sbt.SbtAspectj._
aspectjSettings
aspectjInputs in Aspectj += (aspectjCompiledClasses in Aspectj).value
products in Compile := (products in Aspectj).value
products in Runtime := (products in Compile).value
这是我的Aspect类:
@Aspect
class AnnotationAspect {
@Pointcut("execution(* *(..))")
def call2Lolly(): Unit = {}
@Before("call2Lolly()")
def beforeAdviceCall2Lolli(): Unit = {
println("before executing lolly")
}
这是我的主要课程:
object Main extends App {
new LollyPop().lolly("jjj")
}
'之前'实际上并没有发生。
请帮忙