- 插件模块实际上还是基于Java的jdk代理实现,提供第三方扩展mybatis使用
- 通常我们使用mybatis的插件模块来扩展sql日志的打印,重写sql,分页插件等
模块详情
静态属性
private final List<Interceptor> interceptors = new ArrayList<>();
...大约 3 分钟
private final List<Interceptor> interceptors = new ArrayList<>();
public class ExceptionFactory {
private ExceptionFactory() {
// Prevent Instantiation
}
// 转换异常为mybatis自己的业务报错,
public static RuntimeException wrapException(String message, Exception e) {
return new PersistenceException(ErrorContext.instance().message(message).cause(e).toString(), e);
}
}
public interface DataSourceFactory {
/**
* 设置DataSource相关的属性
* @param props
*/
void setProperties(Properties props);
/**
* 获取 DataSource 相关的设置
* @return
*/
DataSource getDataSource();
}