PDA

View Full Version : ObjectNameAutoProxyCreator null all object member



gnchen
04-03-2009, 03:24 AM
Hi!

I use ObjectNameAutoProxyCreator to add advice. Below is snip in config


<object id="testTaskStep"
type="Broncus.LungPoint.Service.Model.TaskStep, Broncus.LungPoint.Service.Model">
<property name="CommandStr" value="notepad.exe"/>
</object>

<object id="aroundAdvisor" type="Spring.Aop.Support.NameMatchMethodPointcutAdvisor, Spring.Aop">
<property name="Advice">
<object type="Broncus.LungPoint.Service.AOP.Logging.LoggingAdvic e, Broncus.LungPoint.Service.AOP" />
</property>
<property name="MappedNames">
<list>
<value>*Run</value>
</list>
</property>
</object>

<!-- Using ObjectNameAutoProxyCreator -->
<!-- Apply 'aroundAdvisor' on all objects with id that ends by 'Command' -->
<object id="aopLogging" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxy Creator, Spring.Aop">
<property name="ObjectNames">
<list>
<value>*TaskStep</value>
</list>
</property>
<property name="InterceptorNames">
<list>
<value>aroundAdvisor</value>
</list>
</property>
</object>



I found testTaskStep's member or properties are all null.

Anyone know what is going on? If I took the ObjectNameAutoProxyCreator section out. The object's member are intact.

Gen

wimpleshapers
11-11-2010, 05:27 PM
First, if your class does not implement any interfaces then you'll need to set the proxy factory's ProxyTargetType property to true. If you do this, then you'll also apparently need to make all methods you wish to proxy virtual in the base class.