Invalid bound statement (not found): com.park.dao.ParkTreeDao.getParkByCode

多模块开发引用不到其他子模块xml的问题

Invalid bound statement (not found): com.park.enterprise.dao.parkRoomManager.ParkTreeDao.getParkInfoByCode

在模块A中这个方法是没有问题的,mybatis 的xml中确实是有这个sql的

但是在模块B中引用的了模块A,在启动程序的时候也是没有问题的,但是在调用接口时就会提示上面的报错。

后来发现,在模块B启动的时候,根本就没有加载模块A中的Mybatis 配置的xml文件

模块A中的xml配置:

mybatis:
  mapper-locations: classpath:*Mapper.xml

模块B中的xml配置也是:

mybatis:
  mapper-locations: classpath:*Mapper.xml

解决的办法就是将classpath 改为 classpath*

mybatis:
  mapper-locations: classpath*:*Mapper.xml

这样问题就解决了。相当于B模块在启动的时候,就主动加载了A模块的xml文件

猜你喜欢

转载自blog.csdn.net/u014209205/article/details/84677318