插入数据的时候:Cause:..._慕课问答

自问自答,避免大家走弯路:

<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
   <artifactId>mybatis-spring-boot-starter</artifactId>
   <version>1.3.1</version>
</dependency>
<dependency>
   <groupId>tk.mybatis</groupId>
   <artifactId>mapper-spring-boot-starter</artifactId>
   <version>1.2.4</version>
</dependency>
<!--pageHelper-->
<dependency>
   <groupId>com.github.pagehelper</groupId>
   <artifactId>pagehelper-spring-boot-starter</artifactId>
   <version>1.2.3</version>
</dependency>

这个版本的,在扫描mapper的时候,要使用

import tk.mybatis.spring.annotation.MapperScan;

不要使用org.mybatis.spring.annotation.MapperScan;

package com.imooc;

//import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan(basePackages = "com.imooc.mapper")
@ComponentScan(basePackages = "com.imooc")
public class DemoApplication {

   public static void main(String[] args) {
      SpringApplication.run(DemoApplication.class, args);
   }
}

2018-07-15

回复 3


Original url: Access
Created at: 2019-09-23 19:04:16
Category: default
Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论