java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut

来源:互联网 发布:淘宝网书籍杂志在哪找 编辑:程序博客网 时间:2024/05/19 09:15

java.lang.IllegalArgumentException: error at ::0 can’t find referenced pointcut

我在用注解实现spring的AOP时遇到这个异常,提示无法找到切点,检查代码没有发现问题。
我的项目的jdk为1.7.0_07,解决办法是将项目的Jre改为jdk1.6; 然后程序运行正常了。

核心代码:

import org.aspectj.lang.JoinPoint;import org.aspectj.lang.annotation.After;import org.aspectj.lang.annotation.AfterReturning;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Before;import org.aspectj.lang.annotation.Pointcut;import org.springframework.stereotype.Component;@Component("transaction")@Aspectpublic class Transaction {    @Pointcut("execution(* cn.spring.spring_proxy.aop.annotation.PersonDaoImpl.*(..))")    public void persoDao() {    }    // 前置通知    @Before("personDao()")    public void beginTransaction(JoinPoint jointPoint) {        System.out.println(jointPoint.getArgs());        String methodName = jointPoint.getSignature().getName();        System.out.println(methodName);        System.out.println("beginTransaction");    }    // 后置通知    @AfterReturning(pointcut = "personDao()", returning = "val")    public void commit(JoinPoint joinPoint, Object val) {        System.out.println(joinPoint.getArgs());        String methodName = joinPoint.getSignature().getName();        System.out.println("commit");    }    // 最终通知    @After("personDao()")    public void finallyMethod() {        System.out.println("finaly method");    }}

希望能对你有帮助。

0 0
原创粉丝点击