问题描述
我有这个设置,它正在工作:
@pointcut("execution(*com.connection.sendRequest(..))&& cflow(execution(*com.soapService.sendSoapRequest(..)))")
public void interceptSendRequestOnSoapService() {
};
@Before("interceptSendRequestOnSoapService()")
public void interceptSoapRequest(JoinPoint point){
...
};
这很好用并且可以像我需要的那样拦截。
但是,当我将注释更改为“Around”时:
@Around("interceptSendRequestOnSoapService()")
public void interceptSoapRequest(JoinPoint point){
...
};
它根本没有被调用。它甚至从未进入方面。它不会拦截。为什么,我怎样才能让它在@Around 上工作?
解决方法
好吧,我似乎已经想通了。
-
我将第一次执行更改为“调用”。所以调用(* com.connection.sendRequest(..))
-
我让我的方法返回一个对象。所以“返回joinpoint.proceed()”