出现错误

Field userTextMapper in com.springboot.demo.service.UserTextService required a bean of type 'com.springboot.demo.dao.UserTextMapper' that could not be found.

网上解决方案总结

包结构

将启动类放在外层包
SpringBoot启动报错,未找到mapper

注解没有加

SpringBoot启动报错,未找到mapper

配置 mybatis-generator 出现的问题

  1. 启动类加注释:@MapperScan(basePackages = { "mapper所在的包路径" }, sqlSessionFactoryRef = "sqlSessionFactory"),表示扫描xx.xx.mapper包下的所有mapper。
    SpringBoot启动报错,未找到mapper
  2. 直接在你生成出来的xxxMapper.java类上加@Mapper标签。

相关文章:

  • 2021-08-13
  • 2021-07-26
  • 2021-06-26
猜你喜欢
  • 2021-05-23
  • 2022-01-07
  • 2021-12-16
  • 2021-12-09
  • 2022-12-23
  • 2023-03-18
相关资源
相似解决方案