Announcement Announcement Module
Collapse
No announcement yet.
Advised method annotations Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advised method annotations

    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

  • #2
    Sorry to bother....


    @Around( "@annotation(myAnnotation)" )
    public Object doSomething(
    ProceedingJoinPoint pjp, MyAnnotation myAnnotation ) { }

    Comment

    Working...
    X