springboot项目结构

由于mapper.xml分布在不同的模块中,
mybatis.mapperLocations=classpath:mapper/*.xml 不能两个模块中mapper文件夹下的xml文件不能加载
这是因为classpath只加载了一个mapper的改成
mybatis.mapperLocations=classpath*:mapper/*.xml
解决问题
本文解决了一个关于SpringBoot项目中MyBatis多模块配置的问题。具体来说,当mapper.xml文件分散在不同模块时,使用mybatis.mapperLocations=classpath*:mapper/*.xml可以确保所有模块中的mapper文件夹下的XML文件都被正确加载。
springboot项目结构

由于mapper.xml分布在不同的模块中,
mybatis.mapperLocations=classpath:mapper/*.xml 不能两个模块中mapper文件夹下的xml文件不能加载
这是因为classpath只加载了一个mapper的改成
mybatis.mapperLocations=classpath*:mapper/*.xml
解决问题

被折叠的 条评论
为什么被折叠?