Announcement Announcement Module
Collapse
No announcement yet.
Spring AOP get target from proxy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP get target from proxy

    Hello, dear community.

    I am trying to get target object from its proxy. I do the following:

    Code:
      <bean id="myObjectTargetSource" factory-bean="myProxiedObject"
        factory-method="getTargetSource" />
      <bean id="myObjectTarget" factory-bean="myObjectTargetSource"
        factory-method="getTarget" />
    
      <!-- Register Service as MBean -->
      <bean class="org.springframework.jmx.export.MBeanExporter">
        <property name="beans">
          <map>
            <entry key="Systems:name=..."
              value-ref="myObjectTarget" />
          </map>
        </property>
      </bean>
    (myProxiedObject is defined using autowiring) but in jconsole I still see the proxy. Why?

    It looks like myProxiedObject.getTargetSource().getTarget() returns myProxiedObject itself. How can this be?
    Last edited by Bohtvaroh; Jan 12th, 2008, 11:48 PM.

  • #2
    After some debugging I realized that this is MBeanExporter related problem and myProxiedObject.getTargetSource().getTarget() returns target object as expected.

    Comment

    Working...
    X