InsertAroundMethod.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:SpringTutorial 作者:
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {

    System.out.println("Method name : "
            + methodInvocation.getMethod().getName());

    // same with MethodBeforeAdvice
    System.out.println("InsertAroundMethod : Before method inserted!");

    try {
        // proceed to original method call
        Object result = methodInvocation.proceed();

        // same with AfterReturningAdvice
        System.out.println("InsertAroundMethod : after method inserted!");

        return result;

    } catch (IllegalArgumentException e) {
        // same with ThrowsAdvice
        System.out
                .println("InsertAroundMethod : Throw exception inserted!");
        throw e;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号