最快的方法:
直接在properties文件或者yml文件加上这个配置项:
mybatis.mapperLocations=classpath:com.example.demo.mapper/Mapper.xml
或者:
mybatis.mapperLocations=classpath:com.example.demo.mapper/.xml
这样就可以扫到这些mapper xml文件了
第二种方法:
就是mapper的xml文件所在的文件的目录跟其mapper接口包名是一致
而且mapper的xml文件所在的文件的目录 新建的包要用 “ / ” 分开 而不是用 “ . ”
如:com/zhp/mapper 这个是正确的 com.zhp.mapper是错误的
博客地址:
https://blog.csdn.net/qq_39746820/article/details/124571053
https://blog.csdn.net/axbhealj/article/details/130331164(解决绑定不了还有安装插件的)