所以我需要在从特定方法中调用方法时拦截该方法。
我有这个设置,它正在工作:
@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 上工作?
答案 0 :(得分:0)
好吧,我似乎已经想通了。
我将第一次执行更改为“调用”。所以调用(* com.connection.sendRequest(..))
我让我的方法返回一个对象。所以“返回joinpoint.proceed()”