Radan小哥 2022-06-07 18:31 采纳率: 50%
浏览 443
已结题

mapperlocations=classpath:mapper/*.xml 报错,如何解决?

springboot整合mybatis时异常
问题描述
mybatis:
  mapper-locations: classpath:**/*.xml   #这个可以使用
 #mapper-locations: classpath:mappeer/*.xml #这个不行


相关配置文件信息
#datasource
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/javaee?serverTimezone=UTC
    username: root
    password: 123456
    driver-class-name: com.mysql.cj.jdbc.Driver
##mybatis配置

mybatis:

  mapper-locations: classpath:**/*.xml
  #mapper映射文件
  type-aliases-package: com.example.pojo
  #设置别名

userMapper.xml 位置

src/main/resources/mapper/UserMapper.xml

我想要达到的结果

mybatis.mapper-locations= classpath:mapper/*.xml 如何和这样配置也是可以

  • 写回答

1条回答 默认 最新

  • Radan小哥 2022-06-07 18:52
    关注
    mapper-locations: classpath*:m*/*.xml 
    

    这个**/*.xml好像不能用 前面必须得有字母

    #  mapper-locations: classpath:mapper/*.xml 
    

    这个也可以,由于没有指定namespace(没注意看)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 6月15日
  • 已采纳回答 6月7日
  • 创建了问题 6月7日

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器