PDA

View Full Version : RegularExpressionMethodPointcutAdvisor


tdu
05-01-2006, 06:44 PM
I have developed a UpdateContactAdvice. I want to apply that advice only to Update and Upsert method in my IContact interface.
Here is my config:
<object id="UpsertContactAdvice"
type="Spring.Aop.Support.RegularExpressionMethodPointcut Advisor,Spring.Aop">
<property name="advice">
<object type="Aspects.Validations.UpsertContactAdvice,Aspects">
<constructor-arg index="0" ref="UpsertValidationInterface"/>

</object>

</property>
<property name="pattern" >
<list>
<value>UpsertContact</value>
<value>UpdateContact</value>

</list>

</property>


</object>
It didn't work. The UpsertContact and UpdateContact both methods are not fired up with the advice.

But, if I replace the
<property name="pattern" >
<list>
<value>UpsertContact</value>
<value>UpdateContact</value>

</list>

</property>

with this

<property name="pattern" value="UpsertContact" >

</property>

It did fired up the advice when I calls UpsertContact method. What did I wrong or how can I make the regularexpression work the way as it suppose to?

Thanks

Bruno Baia
05-01-2006, 07:02 PM
Hi Tony,

the property "pattern" is used when u only want to set one pattern, use the property "patterns" to specify multiple patterns :


<property name="pattern" value="UpsertContact" />



<property name="patterns" >
<list>
<value>UpsertContact</value>
<value>UpdateContact</value>
</list>
</property>



-Bruno

tdu
05-01-2006, 09:18 PM
Thanks Bruno. It worked.


Tony