Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

pointcut切入拦截的疑问,原方法不执行

项目中使用@Pointcut切入,进行拦截,主要是对数据库update操作的拦截;
但发现拦截后并处理完成后,原本的update方法就不执行,没更新数据了,求解;

@Pointcut("execution(* com.*.pms.dao.*Dao.*(..))")  //拦截所有Dao下的update方法,这用通配*
public void updateData() {    
    
}

@Around(value = "updateData()")
public int around(ProceedingJoinPoint joinPoint) throws NoSuchMethodException, SecurityException {
     Method proxyMethod = joinPointObject.getMethod();  
              Annotation[] annotations = proxyMethod.getAnnotations();
        //      Map<String, Object> newValue = getFieldVlaue(objects[0]);
        //………………业务操作的代码
return 1;

}

这个能正常执行完成,但原方法被切入后就不继续执行了···,求解


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

你需要在代码里用给的参数显式调用原函数。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...