mybatis 分析五 插件demo及源码解析
一、新建自定义插件类 简单打印一下sql /** * 打印sql 插件 */ @Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class, Integer.class}) }) public class PrintSqlInterceptor implements Interceptor { @Override public Object intercept(Invocation invocation) throws Throwable { //Executor (update, query, flushStatements, commit, rollback,getTransaction, close, isClosed) //ParameterHandler (getParameterObject, setParameters) //ResultSetHandler (handleResultSets, handleOutputParameters) //StatementHandler (prepare, parameterize, batch, update, query) StatementHandler target =