原报错信息
这里只是截取核心报错信息,如下: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut
aused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut peforms
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:319)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression
解决方案
方案一,按照网上主流解决方式,调整JDK包和AspectJ包的版本,
如果要使用AspectJ完成注解切面需要注意下面的JDK与AspectJ的匹配:
JDK1.6 —— aspectJ1.6
JDK1.7 —— aspectJ1.7.3+
具体的包,请去网络网上自行下载。这种方案对我无效,我调整了大半天,没用。那个美丽的绿色条条没出现。
方案二:修改代码逻辑,替换@Pointcut部分
@Pointcut() 部分重写,具体的可以看我代码片段部分
/*
@Pointcut("execution(** com.bert.concert.interfaces.Performance.perform(..))")
public void performs() {}
*/
@Before("execution(** com.bert.concert.interfaces.Performance.perform(..)) ")
public void silencePhone() {
System.out.println("Please close off your cellphone .");
}
@Before("execution(** com.bert.concert.interfaces.Performance.perform(..))")
public void takeSeat() {
System.out.println("Please take a seat in five minutes.");
}
@AfterReturning("execution(** com.bert.concert.interfaces.Performance.perform(..))")
public void applause() {
System.out.println("Clap clap ...");
}
@AfterThrowing("execution(** com.bert.concert.interfaces.Performance.perform(..))")
public void demandRefund() {
System.out.println("It is too bad ...Ehh");
}