项目中使用mybatis-plus
pom.xml中添加配置
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.2</version> </dependency>
启动异常:
异常一: 异常java.lang.ClassNotFoundException: org.mybatis.logging.LoggerFactory
异常分析: 导入mybatisplus的同时导入了mybatis的依赖,利用插件dependency Analyzer,查询到mybatis-plus-boot-starter所在的位置。
发现封装的包中引入了,过滤掉即可。 <exclusions> <exclusion> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> </exclusion> </exclusions> 如果显示的引用了此包,直接删除即可。
问题二:异常java.lang.ClassNotFoundException:org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration
解决方式:显示的maven引用
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-autoconfigure</artifactId> <version>2.1.3</version> </dependency>