Spring error at ::0 can't find referenced pointcut myMethod异常

Spring error at ::0 can’t find referenced pointcut myMethod等异常的解决

  刚刚在使用声明方式的AOP编程中,遇到以下两个问题,解决方法如下:

  (1)error at ::0 formal unbound in pointcut

  解决方法:去掉函数通知函数中的参数,比如:将

  @Before(“execution(public void com.zjw.dao.impl.UserDAOImpl.*(..))”)

  error at ::0 can’t find referenced pointcut myMethod

  public void beforeMethod(Method method){

  System.out.println(“method before”);

  }

  改为

  @Before(“execution(public void com.zjw.dao.impl.UserDAOImpl.*(..))”)

  public void beforeMethod(){

  System.out.println(“method before”);

  }

  (2)comzjwdaoImplUserDAOImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can’t find referenced pointcut myMethod

  错误原因:如果你用的JDK版本是1.6的话,而引用的aspectjrt.jar是spring-2.0中包含的jar包的情况下就会报这样的错误。
解决方法:就是下载最新的aspectjrt的jar包即可,或者使用spring3.0中的包!在这边我使用的aspectjrt.jar居然是1.1的 所以出错了 改为aspectj最新版aspectj就没问题了

原文地址:https://www.cnblogs.com/lllini/p/11955359.html