【发布时间】:2011-10-14 12:16:09
【问题描述】:
我正在使用 JSF1.2 框架。 我没有将我的应用程序与 Spring 集成。我想对方法调用执行分析。我的应用程序文件是 EAR (EJB + WAR)。我可以在拦截器的帮助下获取会话 bean 方法的执行时间,但是对于 WAR 模块,我建议在此博客中使用 AspectJ。所以我写了一些代码。有什么我需要做的,比如配置细节。我添加了 AspectJ 所需的 jar 文件是 JSF 支持 AspectJ 有任何配置吗?我的代码是:
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class AopInterceptor implements MethodInterceptor{
public AopInterceptor() {
}
@Pointcut("execution (* *.*(..))")
public void profile(){}
@Around("profile()")
public Object invoke(MethodInvocation mi) throws Throwable {
System.out.println("test start");
Object obj=mi.proceed();
System.out.println("test end");
return obj;
}
}
【问题讨论】:
-
请不要将
[closed]放在您的问题标题中。谢谢。 -
我在 WAR build.xml 文件中创建了一个目标,并添加了 AspectJ jar 文件。现在我得到了所有调用的方法。这是目标代码:
标签: netbeans-6.9 jsf-1.2