先添加
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
其实最重要的应该是缺少如下数据库连接池的包,当使用时druid,这里要添加druid for spring boot依赖,如下:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.9</version>
</dependency>
添加上后项目启动正常。
附加:@Mapper注解对应的包
<!--缺少此jar包,导致@Mapper注解无效-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.2.0</version>
</dependency>
项目启动异常是由于缺少mybatis和druid的依赖。添加mybatis-spring-boot-starter版本2.0.0和druid-spring-boot-starter版本1.1.9的依赖后,问题得到解决。同时,@Mapper注解无效可能是因为缺少mybatis-spring-boot-starter的1.2.0版本。
4万+

被折叠的 条评论
为什么被折叠?



