Mybatis
文章平均质量分 53
基于Java的持久层框架
Deniro Lee
这个作者很懒,什么都没留下…
展开
-
MyBatis自定义拦截器与 pagehelper组件冲突导致自定义拦截器不生效的解决方法
1 问题描述利用 MyBatis 的 @Intercepts 注解自定义了一个拦截器,在纯净环境中运行正常。放入一套Spring框架中不生效。2 原因分析利用 IDEA 的 Jar 包图谱分析器发现存在2个不同版本的 mybatis-spring-boot-starter:怀疑是与 com.github.pagehelper组件不兼容,因为它内部也是利用 MyBatis 的拦截器实现语句自动分页功能的。利用Maven 的exclusions 标签进行冲突检验:<dependency>原创 2021-03-13 16:54:24 · 3342 阅读 · 1 评论 -
NoSuchMethodException: org.apache.ibatis.javassist.bytecode.analysis.Executor.query问题的解决方法
(1)问题描述自定义了一个 MyBatis 拦截器,用于拦截查询语句。拦截器的签名为:@Component@Intercepts( @Signature( type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class} ))public class SelectSqlInterceptor原创 2021-02-21 11:01:48 · 809 阅读 · 0 评论 -
DefaultSqlSession.close 抛出 NullPointerException: null 问题的解决方法
1 问题描述集成了 MyBatis3.x 后,加入 MyBatis 自定义拦截器。抛出 NullPointerException 异常。完整出错日志如下:java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) [spring-boot-2.3.3.R原创 2021-02-21 10:53:34 · 950 阅读 · 3 评论