|
@ -8,7 +8,7 @@ import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
/**
|
|
|
* jdbctemplate 预编译执行拦截
|
|
|
* jdbc
|
|
|
* @author HZY
|
|
|
* @vsrsion 1.0
|
|
|
* Created at 2016/12/7.
|
|
@ -18,7 +18,7 @@ import org.springframework.stereotype.Component;
|
|
|
public class JdbcTemplateAdvice {
|
|
|
|
|
|
@Around("execution(* org.springframework.jdbc.core.JdbcTemplate.query*(..)) || execution(* org.springframework.jdbc.core.JdbcTemplate.execute*(..))")
|
|
|
public void process(ProceedingJoinPoint point) throws Throwable {
|
|
|
public Object process(ProceedingJoinPoint point) throws Throwable {
|
|
|
String schemaName = getSchema();
|
|
|
//访问目标方法的参数:
|
|
|
Object[] args = point.getArgs();
|
|
@ -31,8 +31,9 @@ public class JdbcTemplateAdvice {
|
|
|
args[0]=completeSql;
|
|
|
}
|
|
|
//用改变后的参数执行目标方法
|
|
|
point.proceed(args);
|
|
|
|
|
|
Object returnValue = point.proceed(args);
|
|
|
System.out.println("@Around:被织入的目标对象为:" + point.getTarget());
|
|
|
return returnValue;
|
|
|
}
|
|
|
|
|
|
// @Before("execution(* org.springframework.jdbc.core.JdbcTemplate.query*(..)) || execution(* org.springframework.jdbc.core.JdbcTemplate.execute*(..))")
|