我的第一個(gè)aspectJ程序
MyClass.java:
package com;

public class MyClass
{
public void foo(int age, String name)
{
System.out.println("Inside foo(int,String)");
}

public static void main(String[] args)
{
MyClass myClass = new MyClass();
myClass.foo(1, "zdw");
}

}
HelloWorld.aj:
package com;

public aspect HelloWorld
{
//切入點(diǎn)
pointcut callPointcut() : call(void MyClass.foo(int,String));
//前置通知
before() : callPointcut()
{
System.out.println("Hello World");
System.out.println("In the advice attached to the call pointcut");
}
}































posted on 2008-01-10 18:04 々上善若水々 閱讀(606) 評論(0) 編輯 收藏 所屬分類: Spring