Announcement Announcement Module
Collapse
No announcement yet.
Any hack to cast proxy to class? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Any hack to cast proxy to class?

    Does anyone know of a way to cast a JdkDynamicAOPProxy to the class it is proxying?

    I know, I know - use CGLIB. But this is just for a test, and we're using autoproxying.

    Is there ANY way to do it?

    cheers,

    David

  • #2
    What auto proxy are you using? With something like BeanNameAutoProxyCreator or DefaultAdvisorAutoProxyCreator, you can still set proxyTargetClass=true. This will force the use of CGLIB to generate a subclass and will allow casting to the implementation class.

    Hope this helps.

    Jess

    Comment


    • #3
      yep, could do that - but don't really want to change all the proxying, just to allow us access to this class in the test.

      That's why I was talking about "hacks" :-)

      Comment


      • #4
        Through the proxy object

        Will casting the delegate object work for you? Something like:
        Code:
        MyImpl proxiedObject = (MyImpl)((Advised)myBean).getTargetSource().getTarget();
        -Ramnivas

        Comment

        Working...
        X