Spring aop 注解方式怎么获得执行了目标的某个方法?
来源:互联网 发布:python虚拟主机 编辑:程序博客网 时间:2024/05/17 04:14
private void beforeTransationHandle(JoinPoint point) throws Exception{//拦截的实体类Object target = point.getTarget();//拦截的方法名称String methodName = point.getSignature().getName();//拦截的方法参数Object[] args = point.getArgs();//拦截的放参数类型Class[] parameterTypes = ((MethodSignature)point.getSignature()).getMethod().getParameterTypes();Method m = null;try {//通过反射获得拦截的methodm = target.getClass().getMethod(methodName, parameterTypes);//如果是桥则要获得实际拦截的methodif(m.isBridge()){for(int i = 0; i < args.length; i++){//获得泛型类型Class genClazz = GenericsUtils.getSuperClassGenricType(target.getClass());//根据实际参数类型替换parameterType中的类型if(args[i].getClass().isAssignableFrom(genClazz)){parameterTypes[i] = genClazz;}}//获得parameterType参数类型的方法m = target.getClass().getMethod(methodName, parameterTypes);}} catch (SecurityException e) {e.printStackTrace();} catch (NoSuchMethodException e) {e.printStackTrace();}}
0 0
- Spring aop 注解方式怎么获得执行了目标的某个方法?
- Spring aop 注解方式怎么获得执行了目标的某个方法?
- Spring MVC 集成 AOP,自定义注解,在切面获得方法参数,以及自定义注解的参数。
- spring aop获取目标对象的方法对象及方法上的注解
- spring aop获取目标对象的方法对象(包括方法上的注解)
- spring aop获取目标对象的方法对象(包括方法上的注解)
- spring aop 注解方式
- 通过spring aop去反射目标类方法参数的注解值
- Spring AOP:访问目标方法的参数
- 使用Spring的注解方式实现AOP
- 使用Spring的注解方式实现AOP
- 使用Spring的注解方式实现AOP
- Spring使用注解的方式实现AOP
- 使用Spring的注解方式实现AOP
- 使用Spring的注解方式实现AOP
- 使用Spring的注解方式实现AOP
- 使用Spring的注解方式实现AOP
- 注解方式使用spring aop的步骤
- python tab键补全功能
- Eclipse快捷键大全(转载)
- Frame里打开IE10 IE11 showModalDialog大小调整
- 给你一个详细的VLAN文档
- hbase集群安装
- Spring aop 注解方式怎么获得执行了目标的某个方法?
- sturts2jar 包
- spring AOP 配置多个pointCut
- 给一维数组输入任意n(n<10)个数,假设输入6个整数是7,4,8,9,1,5,建立如下内容的方阵并打印。 5 7 4 8 9 1 1 5 7 4 8 9 9 1 5 7
- 第十三周项目四 数组的排序(2)
- 浅谈Linux的内存管理机制
- win7安装wildfly8.1
- [LInux]安装iBus输入法框架和Pinyin等中文输入法(ubuntu12.04)
- CentOS安装JDK