解决:SpringBoot+Mybatis聚合项目扫描不到*Mapper.xml
SpringBoot+Mybatis聚合项目扫描不到*Mapper.xml
·
目录
1 问题描述
SpringBoot+Mybatis多个模块项目,扫描不到*Mapper.xml文件
2 异常信息
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wen.system.mapper.AppTestMapper.selectByPage
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53)
at org.apache.ibatis.binding.MapperProxy.lambda$cachedInvoker$0(MapperProxy.java:108)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at org.apache.ibatis.util.MapUtil.computeIfAbsent(MapUtil.java:35)
at org.apache.ibatis.binding.MapperProxy.cachedInvoker(MapperProxy.java:95)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at com.sun.proxy.$Proxy159.selectByPageMysql(Unknown Source)
at com.wen.system.AppTestMapperTest.selectByPage(AppTestMapperTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
...
3 yml配置
3.1 修改前
mybatis:
# type-aliases-package: com.wen.system
mapper-locations: classpath:mapper/**/*.xml
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
3.2 修改后
mybatis:
# type-aliases-package: com.wen.system
mapper-locations: classpath*:mapper/**/*.xml
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
3.3 总结
对于多模块项目应该在classpath后面加*
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)