testbeforeadvice.java

来自「aop在项目中的应用」· Java 代码 · 共 20 行

JAVA
20
字号
package simon.tools.aop;

import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.AfterReturningAdvice;

public class TestBeforeAdvice
    implements MethodBeforeAdvice {
  public void before(Method m, Object[] args, Object target) throws Throwable {
    System.out.print("Hello world! (by " + this.getClass().getName() + ")");
    System.out.println("the para1 is: "+args[0]);
  }

  class LogAdvice implements AfterReturningAdvice {
    public void afterReturning(Object returnObject, Method method,
                               Object[] paras, Object instanceObject) {

    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?