musch
Sep 2nd, 2004, 02:03 PM
I try to implement AOP with Spring, but it´s not work, my advise is not call, below is my code and my configuration.
agenciaServiceImpl is a Pojo, and work fine.
<bean id="agenciaServiceImpl" class="com.teste.dao.AgenciaServiceImpl">
<property name="agenciaDao"><ref bean="agenciaDao"/></property>
<property name="bancoDao"><ref bean="bancoDao"/></property>
</bean>
<bean id="makeDaoLog" class="com.teste.util.MakeDaoLog" />
<bean id="agenciaProxyBean" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>com.teste.dao.IAgenciaService</value>
</property>
<property name="interceptorNames">
<list>
<value>makeDaoLog</value>
<value>agenciaServiceImpl</value>
</list>
</property>
</bean>
package com.teste.util;
import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
public class MakeDaoLog implements MethodBeforeAdvice {
public void before(Method m, Object[] args, Object target) throws Throwable {
System.out.println(" pass here ");
}
}
agenciaServiceImpl is a Pojo, and work fine.
<bean id="agenciaServiceImpl" class="com.teste.dao.AgenciaServiceImpl">
<property name="agenciaDao"><ref bean="agenciaDao"/></property>
<property name="bancoDao"><ref bean="bancoDao"/></property>
</bean>
<bean id="makeDaoLog" class="com.teste.util.MakeDaoLog" />
<bean id="agenciaProxyBean" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>com.teste.dao.IAgenciaService</value>
</property>
<property name="interceptorNames">
<list>
<value>makeDaoLog</value>
<value>agenciaServiceImpl</value>
</list>
</property>
</bean>
package com.teste.util;
import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
public class MakeDaoLog implements MethodBeforeAdvice {
public void before(Method m, Object[] args, Object target) throws Throwable {
System.out.println(" pass here ");
}
}