|
From: Dmitriy K. <dko...@ru...> - 2004-12-14 17:10:31
|
Hunter, you could always cast any SpringAOP proxy to the "Advised" instance from which you could get the "target" object via "TargetSource" In order to be able to do that the "opaque" property of "ProxyConfig" must be set to "false" (which is "false" by default). So consider you have "MyService" AOP proxy backed by MyServiceImpl target: ... TargetSource targetSource = ((Advised)myService).getTargetSource(); MyServiceImpl target = (MyServiceImpl)targetSource.getTarget(); Regards, Dmitriy. Hunter Kelly wrote: >Hi there, I'm mucking about with some advanced reflection stuff in Spring. >I need to examine the Fields of an object, unfortunately sometimes the object >I have is an AOP proxy, for certain methods. I know that AopUtils.isAopProxy >will tell me this, which is fine, but I haven't been able to figure out a way >of getting the actual target object - I noticed that there is a certain >amount of stuff for detecting if the object is returning itself, and >returning the proxy, etc. > >Is there some way of getting at the target object, given the proxy? > >Thanks, > >Hunter > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://productguide.itmanagersjournal.com/ >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |