aop:config
/aop:aspect
/aop:config
advisor类
import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;
/**
-
@author seeblack
2015-12-20 下午3:44:55
*/
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);
}
-
}
advisor可以启动加载好
但是为什么**Action**类中方法执行的时候不会受到拦截,也就是不会进入到**before**等方法类