1.在使用代理模式模拟Mapper写了一个核心库coreService,coreControlle.写好后测试发现一直报tk.mybatis.mapper.provider.base.BaseSelectProvider:xxxx
2.开始以为是核心库写错了,将核心库去掉,controller,service,dao依次调用,结果还是报错
3.最后,在网上搜到MapperScan导包的错误.大意了,导包时没注意jar包有两个,如果使用通用Mapper应该导入tk开头的jar包,如下
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
@EnableEurekaClient
@MapperScan(basePackages = "com.user.dao")
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UserApplication.class,args);
}
}