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

  • getAnnotation method returning null.

    I've written some around advice which is advised through a pointcut onto a custom annotation (using the Spring AOP XML config) which is triggered by the proxy correctly.

    However when inspecting the method through reflection by working from the ProceedingJoinPoint instance passed into the method (using getAnnotation and getAnnotations) it appears to have no annotations, which is odd as the Transactional annotation for Hibernate is also on the method and is used as well.

    Reading the thread on this forum with the title "Unable to Access Custom Method Annotations after AutoProxy". I thought that cglib proxying might be the cause of the issue, however on logging out the details of the method and class, it does not appear to be the case.

    I'm a bit puzzled as to what this issue could be, unless something in the Spring AOP or Hibernate byte code rewriting is obliterating the annotations.

  • #2
    It's a known limitation of Spring AOP. You can use either compile- or -load-time AspectJ weaving then. Check corresponding reference section about that - 6.8. Using AspectJ with Spring applications. Also you can check complete load-time weaving example that I posted at the neighbor thread

    Comment

    Working...
    X