自己写了个mybatis的拦截器,拦截方法注释如下:
@Intercepts(value = {
@Signature(type = Executor.class,
method = "update",
args = {MappedStatement.class,Object.class})
})
在这种方式下不知道如何才能得到Connection?我看到用prepare拦截的方式是可以得到的,就是update方式拦截网上都没找到怎么拿到Connection。
Connection conn = (Connection) invocation.getArgs()[0];
具体可以去看一下:http://blog.csdn.net/chenbaige/article/details/72084481