Announcement Announcement Module
Collapse
No announcement yet.
Can i access the calling instance using some Advice ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can i access the calling instance using some Advice ?

    I would like to know if there's a way to access the Join Point where it's the calling instance like the call(pattern) that uses AspectJ ... and not the instance being called, so the target instance ???

  • #2
    It's not possible to get hold of the caller with a proxy-based framework, as only the callee is advised, through the creation of a proxy. You can find some information about the stack trace using the ControlFlow pointcut, but not access the caller instance.

    You can get hold of the callee through the MethodInvocation object or arguments to other advice types. You can set the AOP framework to expose the invocation to objects other than advices if necessary using the ExposeInvocationInterceptor.

    Hope this helps.

    Comment


    • #3
      How to use ExposeInvocationInterceptor?

      I get this tomcat error when I integrate my <aop:config> using pointcut into my applicationcontext.xml. How ever it just works fine through my junits.

      The Error:
      java.lang.IllegalArgumentException: Interceptor type not supported: org.springframework.aop.interceptor.ExposeInvocati onInterceptor

      The aop config:
      <aop:config>
      <aopointcut id="servicePointcut" expression=" execution(*com.abc.XYZ+.blah(..)) "/>

      <aop:aspect id="permissionsAspect" ref="accessFilter">
      <aop:before
      method="checkPermissions"
      pointcut-ref="servicePointcut"/>
      </aop:aspect>
      </aop:config>

      Comment

      Working...
      X