我正在使用JSF1.2框架。 我沒有將我的應用程序與Spring集成。我想執行對方法調用的分析。我的應用程序文件是EAR(EJB + WAR)。我可以在攔截器的幫助下獲得會話bean方法的執行時間,但對於WAR模塊,我建議在此博客中使用AspectJ。所以我寫了一些代碼。有什麼我需要做的事情就像配置細節。我添加了所需的jar文件AspectJ是JSF支持AspectJ與任何配置?我的代碼是:AspectJ與JSF1.2
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;
}
}
請不要放''中[關閉]你的問題標題。謝謝。 –
我已經在WAR build.xml文件中創建了一個目標,並添加了AspectJ jar文件。現在我正在獲取所有調用的方法。這裏是targer代碼: –