Hi,
I have a problem with the MethodBeforeAdvise. I "registered" a class so all Method calls should be catched by an MethodBeforeAdvise-Implementation:
Heres the class which should be watched:Code:public class Logging implements MethodBeforeAdvice { private Logging(){ } public void before(Method method, Object[] args, Object target)throws Throwable{ System.out.println(method.getDeclaringClass() + ": " + method.getName()); } }
I simplified the classed so you dont get confused.Code:public class XDao implements IXDao{ public ArrayList getAllX() { this.getX(0); } } public Mandant getX( Integer XId){ }
And heres my applicationContext.xml:
So actually all method calls should be catched by the Advice.Code:<bean id="xDaoTarget" class="XDao"></bean> <bean id="theTracingAdvice" class="Logging" /> <bean id="theTracingBeforeAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor" > <property name="advice"> <ref local="theTracingAdvice" /> </property> <property name="pattern"> <value>.*</value> </property> </bean> <bean id="xDao" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="proxyInterfaces"> <value>IXDao</value> </property> <property name="target"> <ref local="xDaoTarget" /> </property> <property name="interceptorNames"> <list> <value>theTracingBeforeAdvisor</value> </list> </property> </bean>
This works fine when I call the getAllX()-Method (I get a print at the console). But the method called within the getAllX()-Method is not catched by the Advice.
Does anyone know why this is so?
Thanks in advance...


Reply With Quote