1

In AspectJ we have two concepts:

  1. Target object
  2. AOP proxy

I instantiated a target object and then passed it to the proxy factory and advised it. In order to get the new advised object, I must call proxyFactory.getProxy().

My target object is an Spring bean which other beans use. Once it is advised by proxyFactory how do I replace the target object with the AOP proxy everywhere it is used? I'm using Spring context.

I think AspectJ does something similar, because you just add some XML tags that contain "aop" and then your beans contain the new advised methods.

John Watts
  • 8,717
  • 1
  • 31
  • 35
saman
  • 199
  • 4
  • 17
  • The question was confusing so I rewrote it. Is it still the same question, or did I change the meaning? Specifically, I am trying to clarify two points. First, do you want all users of your bean to get the proxy once it is created? Second, in your original wording, it sounded like they should use the bean directly until some point when the proxy is created and then they all start using the proxy. Should all users of your bean use only the proxy for the lifetime of the application? – John Watts Jul 04 '12 at 18:16
  • This might help you - http://stackoverflow.com/q/3489428/204788 – Biju Kunjummen Jul 04 '12 at 21:29

0 Answers0