赞
踩
项目场景:我们想尝试新版本的MyBatis-Plus,使用目前比较新的版本3.5.3
描述: 配置都确保正常且跟MyBatis-Plus官网配置一样后,启动项目时就会报错,无法找到xxxMapper,报错如下:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userController’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userServiceImpl’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [D:\learnData\java_learning\project\cloudsurvey\target\classes\cn\itsource\code\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration’: Initialization of bean failed; nested exception is java.lang.TypeNotPresentException: Type com.baomidou.mybatisplus.extension.ddl.IDdl not present
缺少依赖,在pom.xml文件添加下面依赖
<!--引入mybatis-plus依赖-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3</version>
</dependency>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。