Announcement Announcement Module
No announcement yet.
Access to caller's object Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access to caller's object

    Hi all,

    I'm wondering if there is a possibility to get access to the caller object.
    We are currently using aop to proxy the ejb-tier with the ProxyFactoryBean and have written some nice interceptors using the aop-feature of spring.

    Now we need to integrate an additional aspect in the application for which we need access to the caller's object (the object who calls the backend-service).

    Is this possible and in the sense of aop?

    Thanks for any ideas/comments.


  • #2
    A proxy-based framework such as Spring AOP won't give you access to the caller, as it effectively wraps the callee. A Spring ControlFlow pointcut will let you know the class of the caller, but will not give access to the instance.

    If you need access to the actual instance, and can't refactor to avoid it, I would recommend looking to integrate either AspectJ or AspectWerkz with Spring. AspectJ integration works nicely in Spring 1.1 and above (configure AspectJ aspects via Dependency Injection, as described in the Spring reference manual); Jonas Boner, AspectWerkz lead, has blogged a couple of times on Spring/AspectWerkz integration.



    • #3
      How to find the calling class Name?

      I have a postInterceptors defined for a TransactionalProxyFactory, I would like to know the way to know abt the callee for this intercepted method.
      Also, where can I find the interceptor order, ie., say Im using a LoggingBefore and LoggingAfter advices. What is the order of it with preInterceptor and postInterceptors?