SpringBoot(九):多模块下mapper分散后无法启动SpringBoot解决方法

问题描述:

SpringBoot项目之前是一个项目*-web,运行没问题,后来将项目拆分为多个项目,就出现启动失败问题.

SpringBoot项目结构:

项目被分为多块:*-mapper(mybatis)/*-model/*-web,项目将-mapper分开一个模块后,从SpringBoot入口函数启动,发现SpringBoot启动卡死:

解决问题:

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

mybatis.mapperLocations=classpath*:mapper/*.xml



原文地址:https://www.cnblogs.com/yy3b2007com/p/10315201.html