📄 testaroundadvice.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 + -