jonmor
Feb 7th, 2005, 05:37 AM
I've been dipping my toe in the waters of Spring AOP with a simple interceptor which does nothing but log when it is being used, using a method in a Test class called doTest(). When I test it with the following in the config, it works.
<bean id="methodTestPointCut" class="org.springframework.aop.support.RegexpMethodPointc utAdvisor">
<property name="advice">
<ref local="testInterceptor"/>
</property>
<property name="patterns">
<list>
<value>.*</value>
</list>
</property>
</bean>
However, when I change the pattern to <value>.do*</value> or <value>.do.*</value>, it no longer gets intercepted, which surprises me as the method is called 'doTest()'. So how do I intercept all methods beginning with 'do' or 'get' or whatever? Are there some examples somewhere?
<bean id="methodTestPointCut" class="org.springframework.aop.support.RegexpMethodPointc utAdvisor">
<property name="advice">
<ref local="testInterceptor"/>
</property>
<property name="patterns">
<list>
<value>.*</value>
</list>
</property>
</bean>
However, when I change the pattern to <value>.do*</value> or <value>.do.*</value>, it no longer gets intercepted, which surprises me as the method is called 'doTest()'. So how do I intercept all methods beginning with 'do' or 'get' or whatever? Are there some examples somewhere?