mybatisplus中使用SqlRunner出错

错误描述:

SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@739488d7] was not registered for synchronization because synchronization is not active
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@739488d7]
2019-12-14 11:29:18.044 ERROR 7620 --- [nio-8001-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null
    at org.apache.ibatis.session.defaults.DefaultSqlSession.close(DefaultSqlSession.java:263)
    at org.mybatis.spring.SqlSessionUtils.closeSqlSession(SqlSessionUtils.java:195)
    at com.baomidou.mybatisplus.extension.toolkit.SqlRunner.closeSqlSession(SqlRunner.java:234)
    at com.baomidou.mybatisplus.extension.toolkit.SqlRunner.selectList(SqlRunner.java:156)

错误解决:

public Object plugin(Object target) {
        logger.info("=========== plugin ================");
        return Plugin.wrap(target, this);
    }

posted on 2019-12-14 11:33  Java挖掘机  阅读(2867)  评论(0编辑  收藏  举报

导航