开发者社区 问答 正文

spring boot和mybatis整合中,mapper的xml文件应该如何配置

在尝试进行spring boot和mybatis的整合,但运行时总是报Invalid bound statement (not found)这个错,搜索了一下很多人认为是mapper找不到所致,我是用工具生成的mapper,有接口和xml文件两个部分,xml文件位置在application.yml中该如何配置呢?我现在的配置如下

spring:
  datasource:
    username: root
    password:
    url: jdbc:mysql://localhost:3306/test
    driver-class-name: com.mysql.jdbc.Driver

mybatis:
  mapperLocations: classpath:mapping/*.xml

展开
收起
蛮大人123 2016-03-11 11:44:52 7331 分享 版权
2 条回答
写回答
取消 提交回答
  • 一般是路径没匹配上
    mybatis:

    typeAliasesPackage: com.modou.**.domain  
    mapperLocations: classpath:/com/abc/**/mapper/*.xml  
    configLocation: classpath:/mybatis-config.xml  
    2019-07-17 18:58:53
    赞同 展开评论
  • 我说我不帅他们就打我,还说我虚伪

    是mapper的xml文件路径配置有问题。

    2019-07-17 18:58:53
    赞同 展开评论