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"));