I am quite newbie to AOP but I thought that I have not used a good waysful to get annotations adviced methods.
I tried this
Code:private ValidationEnabled getValidationEnabled(ProceedingJoinPoint jp) { Signature signature = jp.getSignature(); Object[] objects = jp.getArgs(); List<Class<?>> list = new ArrayList<Class<?>>(); for (Object object : objects) { list.add(object.getClass()); } Class s[] = new Class[objects.length]; list.toArray(s); Method method = ReflectionUtils.findMethod(signature.getDeclaringType(), signature.getName(),s); return method.getAnnotation(ValidationEnabled.class); }
And also I have used
Code:@Around("@annotation(com.xxx.ValidationEnabled)") public Response check(ProceedingJoinPoint jp) { }
Is there an easy way to get annotation which is adviced?
Thanks![]()


Reply With Quote