⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testaroundadvice.java

📁 《基于Eclipse的开源框架技术与实战》[第9章]随书源码
💻 JAVA
字号:
package com.free.spring.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * <p>Title: Eclipse Plugin Development</p>
 * <p>Description: Free download</p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: Free</p>
 * @author gan.shu.man
 * @version 1.0
 */

/**
 * 环绕通知
 * */
public class TestAroundAdvice implements MethodInterceptor {
    protected static final Log log = LogFactory.getLog(TestAroundAdvice.class);

    public Object invoke(MethodInvocation invocation) throws Throwable {
    	//方法调用时,相应处理
        log.info("------before Around-------");
        //给方法参数赋值
        invocation.getArguments()[0] = "------new param------";
        //调用被拦截的方法
        Object result = invocation.proceed();
        log.info("------after Around-------");
        return result;
    }
}

⌨️ 快捷键说明

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