该拦截器会在bean的方法执行后被执行
配置文件
完整代码见附件
import java.lang.reflect.Method;
import org.springframework.aop.AfterReturningAdvice;
public class DaoMethodAfterAdvice implements AfterReturningAdvice {
public void afterReturning(Object arg0, Method arg1, Object[] arg2,
Object arg3) throws Throwable {
System.out.println("[DaoMethodAfterAdvice]:" + arg0 + " : " + arg2[0]);
}
}
配置文件
<bean id="beforeDaoAdvice" class="com.zakisoft.workspace.initcompt.advice.DaoMethodBeforeAdvice"></bean>
<bean id="afterDaoAdvice" class="com.zakisoft.workspace.initcompt.advice.DaoMethodAfterAdvice"></bean>
<bean id="throwsDaoAdvice" class="com.zakisoft.workspace.initcompt.advice.DaoThrowsAdvice"></bean>
<bean id="aroundAdvice" class="com.zakisoft.workspace.initcompt.advice.DaoMethodAroundAdvice"></bean>
<bean id="daoAopService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="mybatisDaoBean"></property>
<property name="interceptorNames">
<list>
<value>beforeDaoAdvice</value>
<value>afterDaoAdvice</value>
<value>throwsDaoAdvice</value>
<value>aroundAdvice</value>
</list>
</property>
</bean>
完整代码见附件