MyBatis拦截器

org.apache.ibatis.exceptions.PersistenceException:

Error opening session. Cause: java.lang.NullPointerException

Cause: java.lang.NullPointerException

image.png

springboot下的mybatis拦截器,和单独用mybatis的拦截器一样,但是不需要配置,直接在拦截器前面加个@Component 注解,在plugin 方法中将请求转发到intercept方法拦截即可,不需要其他配置。

2.拦截mybatis执行的BoundSql中的sql语句。通过修改sql语句,或者在BoundSql中添加Parameter来改变最后在mysql中执行的sql语句。


image.png

3.分页 https://elim.iteye.com/blog/1851081

你可能感兴趣的:(MyBatis拦截器)