wwwneil 2013-07-16 02:18 采纳率: 0%
浏览 7269

Spring 中的Annotation 关于@Pointcut 的问题

package com.bjsxt.aop;

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;

@Aspect
@Component
public class Inteceptor {

@Pointcut("execution(public * com.bjsxt.dao..*.*(..))")
public void myMethod(){};

@Before("myMethod()")
public void beforMethod(){
System.out.println("method starts");
}
@AfterReturning("myMethod()")
public void afteMethod(){
System.out.println("method  ends");
}

}

错误 nested exception is java.lang.IllegalArgumentException: error at

::0 can't find referenced pointcut myMethod

JDK 1.7 spring-framework-2.5.6

beans.xml:

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">


  • 写回答

2条回答

  • wwwneil 2013-07-16 02:21
    关注

    补充一下 beans.xml是没问题的

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序