这是我applicationCotext.xml中的配置文件
aop:config
/aop:aspect
/aop:config
这是我的advices类
public class Advisor {
static Logger log = Logger.getLogger(Advisor.class);
public String information;
/**
*
*/
public Advisor() {
// TODO Auto-generated constructor stub
log.info("进入");
}
public void before(JoinPoint joinpoint){
information = "通知:"+joinpoint.getClass().getName()+"类的"+joinpoint.getClass().getMethods()+"开始执行";
log.info(information);
}
public void after(JoinPoint joinpoint){
information = "通知:"+joinpoint.getClass().getName()+"类的"+joinpoint.getClass().getMethods()+"执行完毕";
log.info(information);
}
public void exception(JoinPoint joinpoint){
information = "通知:"+joinpoint.getClass().getName()+"类的"+joinpoint.getClass().getMethods()+"出现异常";
log.info(information);
}
}