1。配置包扫描和启用AOP自动代理

<context:component-scan base-package=“action,service,dao,domain,aspect”>
<context:include-filter type=“annotation”
expression=“org.aspectj.lang.annotation.Aspect”/>
</context:component-scan>
<aop:aspectj-autoproxy/>

2。类中使用Aspect和@After等注解

@Aspect
public class LogAspect {
@AfterReturning(returning=“rvt”,pointcut=“execution(* service.impl..(…))”)
public void log(Object rvt)
{
System.out.println("it is "+(int)rvt);
}}