EJB 中切面编程的简单用法:
第一步:定义切面
public class MyAspect{
@AoundInvoke
public Object around(InvocationContext ic)throws Exception{
//to do something before the pointcut
Object res=ic.proceed();
// to do something after the pointcut
return res;
}
}
第二步:把切面绑定的目标方法或类
@Interceptors({MyAspect.class})
public void me(){
//something
}