pjydc
Apr 7th, 2005, 11:19 PM
Hi, I want to apply an advisor to multiple beans at the same time. I tried BeanNameAutoProxyCreator as follows:
<bean id="myAutoProxyCreator"
class="org.springframework.aop.framework.autoproxy.BeanNa meAutoProxyCreator">
<property name="beanNames">
<value>*Manager</value>
</property>
<property name="interceptorNames">
<list>
<idref bean="myAdvisor"/>
</list>
</property>
</bean>
<bean id="advisor" class="org.springframework.aop.support.DefaultPointcutAdv isor">
<property name="advice">
<ref local="myInterceptor"/>
</property>
<property name="pointcut">
<bean class="org.springframework.aop.support.JdkRegexpMethodPoi ntcut">
<property name="pattern">
<value>^org.example.service.[a-zA-Z]{1}(\\w)*Manager.(\\w)*</value>
</property>
</bean>
</property>
</bean>
The reason why I am using JdkRegexpMethodPointcut is because there are many other Manager objects that are from the Spring and other packages. So I want to add some restriction.
The problem is that none of my service methods get called. Am I doing something wrong? Is the above declaration correct?
Thanks, Pete
<bean id="myAutoProxyCreator"
class="org.springframework.aop.framework.autoproxy.BeanNa meAutoProxyCreator">
<property name="beanNames">
<value>*Manager</value>
</property>
<property name="interceptorNames">
<list>
<idref bean="myAdvisor"/>
</list>
</property>
</bean>
<bean id="advisor" class="org.springframework.aop.support.DefaultPointcutAdv isor">
<property name="advice">
<ref local="myInterceptor"/>
</property>
<property name="pointcut">
<bean class="org.springframework.aop.support.JdkRegexpMethodPoi ntcut">
<property name="pattern">
<value>^org.example.service.[a-zA-Z]{1}(\\w)*Manager.(\\w)*</value>
</property>
</bean>
</property>
</bean>
The reason why I am using JdkRegexpMethodPointcut is because there are many other Manager objects that are from the Spring and other packages. So I want to add some restriction.
The problem is that none of my service methods get called. Am I doing something wrong? Is the above declaration correct?
Thanks, Pete