SpringBoot引入mapper-spring-boot-starter
之后,开发模式热重载下报错
tk.mybatis.mapper.provider.EmptyProvider中缺少selectOne方法!
解决步骤:
1、新建一个配置文件
src/main/resources/META-INF/spring-devtools.properties
#业务包,依赖的其他业务组件(避免热部署的devtools和通用mapper的冲突) restart.include.hifi=/hifi-[\\w-\\.\\d]+.jar restart.include.mybatis=/mybatis-[\\w-\\.\\d]+.jar restart.include.mapper=/mapper-[\\w-\\.\\d]+jar restart.include.pagehelper=/pagehelper-[\\w-\\.\\d]+jar
mapper版本过低也会报错
Caused by: org.apache.ibatis.builder.BuilderException: Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseSelectProvider.dynamicSQL). Cause: java.lang.InstantiationException: tk.mybatis.mapper.provider.base.BaseSelectProvider
2、需要升级版本(1.2.4->2.0.0)
<!--版本过低会报错--> <dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper-spring-boot-starter</artifactId> <version>2.0.0</version> </dependency>
参考
tk.mybatis.mapper.MapperException: tk.mybatis.mapper.provider.EmptyProvider中缺少selectOne方法!