pagehelper和mybatis-plus整合笔记

pagehelper和mybatis-plus整合遇到的坑

  • 异常:ClassNotFoundException: org.mybatis.logging.LoggerFactory

异常:ClassNotFoundException: org.mybatis.logging.LoggerFactory

通过maven引入分别引入pagehelper包和mybatis-plus包

    
        com.github.pagehelper
        pagehelper-spring-boot-starter
    
    
        com.baomidou
        mybatis-plus-boot-starter
    

     在启动时却抛出了奇怪的异常ClassNotFoundException: org.mybatis.logging.LoggerFactory
经过一顿排查,发现pagehelper-spring-boot-starter引入了mybatis和spring的整合包,即mybatis-spring,而mybatis-plus-boot-starter也引入了相关的包。
     本人此处的pagehelper使用mybatis-spring的版本是1.3.2的,而mybatis-plus引入的是2.0.0的,在尝试移除mybatis-plusmybatis-spring包,发现问题得不到解决,转而移除pagehelper下的mybatis-spring包后,成功启动!

  • 修改如下:
    
        com.github.pagehelper
        pagehelper-spring-boot-starter
        
            
                mybatis-spring
                org.mybatis
            
        
    
    
        com.baomidou
        mybatis-plus-boot-starter
    

你可能感兴趣的:(开发,java)