配置动态多数据源出现的问题
- Debug时卡在
-
- Property ‘mapperLocations’ was specified but matching resources are not found.
-
- 问题:resource中的mapper.xml文件无效。
- 问题出现的地方:配置动态多数据源DynamicDataSourceConfiguration类时,里面规定的mapper的对应地址出现问题。
-
public static final String MAPPER_XML_PACKAGE = "classpath*:com/dahua/demo/mapper/*.xml";
- 修改成
public static final String MAPPER_XML_PACKAGE = "classpath*:mapper/*.xml";
- 介绍一个很好的教程:https://blog.csdn.net/qq877728715/article/details/115400285