'com.example.mybatisplus.mapper.PersonMapper' that could not be found.
2024-09-05 03:53:46
通常有两种原因,配置原因,或者是mapper相关文件,mapper.java或 mapper.xml内部错误
如果是配置原因
解决方式1
统一配置mapper
//import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
@MapperScan("com.example.mybatisplus.mapper") //把这个加上,别写上正确的路径,如果是模块化一般路径为@MapperScan("com.kfit.*.mapper")
public class Application { public static void main(String[] args){
System.out.println("hahahaha");
SpringApplication.run(Application.class, args);
} }
解决方式2
每个mapper文件配置@Mapper
package com.example.mybatisplus.mapper; //import org.apache.ibatis.annotations.Mapper; import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.example.mybatisplus.entity.Person;
@Mapper //每个文件配置这个
public interface PersonMapper extends BaseMapper<Person> {
Integer listCount();
Person findPersonById(Integer id);
}
两者可以结合使用
最新文章
- Velocity初探小结--velocity使用语法详解
- Webpack中hash与chunkhash的区别,以及js与css的hash指纹解耦方案
- 在IIS7.5中ASP.NET调用cmd程序拒绝访问决绝方法小记
- windows查看端口占用以及关闭相应的进程
- springmvc自定义日期编辑器
- 虚拟机安装CentOS6.3两个问题
- Volley HTTP库系列教程(5)自定义一个Volley请求
- Linux磁盘占用100%解决方法
- poj3067
- 转:Unicode字符集和多字节字符集关系
- keepalive support-----Programming applications
- 使用 Spring Data JPA 简化 JPA 开发
- Analyzing UI Performance with Systrace 使用systrace工具分析ui性能
- CSS3 动画触发事件
- Week 5a - Mouse input and more lists ----mouse input
- List<;T>;集合导出csv方法参考,通过增加自定义的属性控制输出的字段。
- VisualSVN 5.1.7破译License Key
- JS_正则表达式_获取指定字符之后指定字符之前的字符串
- Android dp、dip、dpi、px、sp简介及相关换算,及其应用实例
- 翻译下 golang package time
热门文章
- 20191011-构建我们公司自己的自动化接口测试框架-Config配置
- 【5号课堂】scratch制作电子生日贺卡
- shell习题第27题:带选项的增删用户脚本
- Django-redis配置cache和session
- eclipse怎样修改同名包(package)的显示样式、格式
- 基因组所三代单分子测序PacBio完成技术升级—超长读长助力基因组学研究
- 路由器开源系统openwrt配置页面定制
- ASP.NET WEB应用程序(.network4.5)MVC Razor视图引擎2 动态数据的呈现
- vue html属性绑定
- linux环境安装docker,部署应用