动态代理所代理的Controller中含有RedirectAttributes时报错java.lang.NoSuchMethodException

今天在写项目的时候,做一个日志模块,记录用户在系统中做的操作。但是在AOP事务通知里面,通过.class对象.getMethod获取用户执行的方法时,传递的参数列表中带有RedirectAttributes的都会报异常java.lang.NoSuchMethodException
动态代理所代理的Controller中含有RedirectAttributes时报错java.lang.NoSuchMethodException动态代理所代理的Controller中含有RedirectAttributes时报错java.lang.NoSuchMethodException
后来通过debug,找到异常详细描述如下
动态代理所代理的Controller中含有RedirectAttributes时报错java.lang.NoSuchMethodException最后将 RedirectAttributes 改为RedirectAttributesModelMap就能正常使用了
动态代理所代理的Controller中含有RedirectAttributes时报错java.lang.NoSuchMethodExceptionRedirectAttributes是一个接口,RedirectAttributesModelMap 是 RedirectAttributes的实现类动态代理所代理的Controller中含有RedirectAttributes时报错java.lang.NoSuchMethodException
前面声明参数的时候用的是接口,接口不能被实例化,在将获取其class对象传递过去获取方法的时候会出现java.lang.NoSuchMethodException,所以需要用到其实现类来声明

如解释有错望指正,虚心向学