SpringBoot扫不到Mapper包

335 阅读1分钟
  1. application.yml 检查是否增加了mapper-Locations
mybatis:
  mapper-Locations: classpath*:/mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true  # 数据库_对象转驼峰自动转换

这里我设定的mapper.xml在resource/mapper下面

  1. Springboot启动类 在这里插入图片描述 增加@MapperScan注解,扫描Mapper路径

mapper.xml 检查namespace是否可以对应mapper

到此,感谢各位观看,希望能帮助到大家。如果有不对的地方或更好的建议还请大佬们指教。