|
@@ -3,6 +3,7 @@ package com.boman.common.datascope.aspect;
|
|
|
import java.lang.reflect.Method;
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
|
import org.aspectj.lang.Signature;
|
|
|
+import org.aspectj.lang.annotation.AfterReturning;
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.aspectj.lang.annotation.Before;
|
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
@@ -71,6 +72,23 @@ public class DataScopeAspect
|
|
|
handleDataScope(point);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 功能描述: 拿到返回值
|
|
|
+ *
|
|
|
+ * @param joinPoint joinPoint
|
|
|
+ * @param rvt 别切的方法的返回值
|
|
|
+ * @return java.lang.Object
|
|
|
+ */
|
|
|
+ @AfterReturning(returning = "rvt", pointcut = "@annotation(com.boman.common.datascope.annotation.DataScope)")
|
|
|
+ public Object AfterExec(JoinPoint joinPoint, Object rvt) {
|
|
|
+ System.out.println("AfterReturning增强:获取目标方法的返回值:" + rvt);
|
|
|
+ MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
|
|
+ Method method = signature.getMethod();
|
|
|
+ String name = method.getName();
|
|
|
+ System.out.println("AfterReturning增强:获取目标方法的方法:" + name);
|
|
|
+ return rvt;
|
|
|
+ }
|
|
|
+
|
|
|
protected void handleDataScope(final JoinPoint joinPoint)
|
|
|
{
|
|
|
// 获得注解
|