PDA

View Full Version : Proxied object export problem



Bohtvaroh
Jan 13th, 2008, 01:25 AM
Hello, dear community.

I have a proxied object with transaction management advices applied to it. I am trying to get the target from it:



myProxiedObject.getTargetSource().getTarget()


and publish the resulting target with MBeanExporter:



<bean class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="Systems:someName" value-ref="target" />
</map>
</property>
</bean>


but in jconsole I still see a bulk of methods and fields from proxy and more - I can invoke them! But i'd like to have only business logic methods from the target (as I see in jconsole when not applying any advice) and not aop-proxy related stuff.

What wrong am I doing?

Bohtvaroh
Jan 13th, 2008, 07:02 AM
As debugger says:

target.getClass().getName() -xxxxxx.somesystem.solution1.service1.service.Servi ce1Impl

proxy.getClass().getName() - $Proxy9

But it looks like $Proxy9 is exported anyway. :-S

Bohtvaroh
Jan 13th, 2008, 07:34 AM
This helps, but it's not right problem solution.



<!-- Register Service as MBean -->
<bean class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="Systems:name=somename" value-ref="myObjectProxy" />
</map>
</property>
<property name="assembler" ref="serviceMBeanInfoAssembler" />
</bean>

<bean name="serviceMBeanInfoAssembler" class="org.springframework.jmx.export.assembler.Interface BasedMBeanInfoAssembler">
<property name="managedInterfaces">
<list>
<value>myBusinessObjectInterface</value>
</list>
</property>
</bean>