Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring AOP  RSS feed

 
Saman Sauron
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi this is my first post here ......

I want to intercept all the DAO method which used to inset and update records in my application. So i used spring AOP. Evey thing went fine except defining the correct method structure pattern.

<bean id="customerAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="patterns">
<list>
<value>com.test.application.*.dao.*</value>
</list>
</property>


The above regx pattern will intercept all the method of the all the classes in the dao (com.test.application.*.dao.) package. but i just want to intercept the methods starting from add and save only. So when i used the following it was not working.


<list>
<value>com.test.application.*.dao.*.save*</value>
</list>
<list>
<value>com.test.application.*.dao.*.add*</value>
</list>

Can anybody printout the issue here ?? Thank you
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you are using the JDK regex matching, use "com\\.test\\.application\\..*\\.dao\\..*(save|add).*".
This will match any methods starting with "save" or "add", under the "com.test.application.XXX.dao" package, where XXX is anything.
 
Saman Sauron
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great reply .....
Thank you very much for quick respond. i ll give a try .....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!