springboot多数据源整合mybatis中出现的Invalid bound statement(not found)的问题

springboot多数据源整合mybatis时,只有一个数据源生效,哪一个数据源为primary就能够正常访问,可是另外一个数据源访问就会报错。mysql

Invalid bound statement(not found)

以前代码中mybatis mapper路径每一个数据源配置各自的mapper目录spring

bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/mysql-1/*.xml"));

这样第二个数据源访问报错sql

应该修改成:springboot

bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/**/*.xml"));
相关文章
相关标签/搜索