现在要切 RestServiceFacade1 的callService ,但是进入不了切面E2EAspect的serviceAround方法,spirng代码在下方
public class RestServiceFacade1 {
public static Object callService(Object in, Class outC, String serviceName) throws Exception {
String msg2send = JsonUtil.oToJ(in);
System.out.println("targetUrl:"+targetUrl+serviceName);
System.out.println("待发送报文为:"+msg2send);
//"{\"name\":\"tset\"}";//
String outData = HttpUtil.postData(targetUrl+serviceName, msg2send);
System.out.println("outData="+outData);
return JsonUtil.jToO(outData, outC, null);
}
public static Object callService(Object in, Class outC) throws Exception {
return callService(in, outC, null);
}
}
public class E2EAspect {
public Object serviceAround(ProceedingJoinPoint joinPoint) throws Throwable {
logger("进入serviceAround 切入方法");
BaseRequestRest in = (BaseRequestRest) joinPoint.getArgs()[0];
String svcName = in.getServiceName();
Object result;
// if (e2eSvcList.contains(svcName)) {// 判断该服务是否需要拦截
if (true) {// 所有服务都需要拦截
logger("服务名(" + svcName + ")需要拦截,进入端到端处理逻辑");
result = E2EAopHandle.handleE2E(joinPoint, TRACEID, PARENTCALLID, 2);
logger("服务名(" + svcName + "),端到端处理结束");
} else {
result = joinPoint.proceed();
}
logger("退出serviceAround 切出方法");
return result;
}
}
配置文件说明===============
<bean id="restServiceFacade" class="com.self.client.RestServiceFacade1" />
<!-- 端到端日志切面 -->
<bean id="e2EAspect" class="com.self.e2e.E2EAspect" />
<aop:config proxy-target-class="true" >
<aop:aspect ref="e2EAspect">
<aop:pointcut expression = "execution(* com.self.client.RestServiceFacade1.*(..))" id = "restServiceFacadeCall" />
<aop:around
pointcut-ref="restServiceFacadeCall"
method="serviceAround" />
</aop:aspect>
</aop:config>