Results 1 to 3 of 3

Thread: Custom pointcut isn't checked for classes with @Transactional annotated methods

  1. #1

    Default Custom pointcut isn't checked for classes with @Transactional annotated methods

    I have a custom PointcutAdvisor (extends StaticMethodMatcherPointcutAdvisor) which implements that implements it' matches() method to match all methods that implement a custom annotation (@Audited).

    My pointcut was not being triggered for certain methods that I had annotated with the @Audited method and mu debugging led me to print out all the Classes/methods that were being passed to my pointcut matches() method.

    looking at the results, i quickly saw that all of my classes which had @Transactional annotation on at least one method were not being passed to the pointcut matches() method for matching.

    I feels like it must be something to do with the proxying of the @Transactional classes, but certainly unexpected behaviour.

    Any ideas?

    Thanks

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    You get the proxied instance, instead of the actual underlying instance. Use the class utilities provided by spring to check if a certain annotation is present.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    Thanks for the response.

    Which utility classes are you referring to. AopUtils/ClassUtils?

    But the
    Code:
    matches(Method method, Class<?> clazz)
    executes at load time and thus doesn't take an instance of the class being checked for the advice.

    It seems like the spring context loader should retrieve the pro xy target class an pass that to the matches() method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •