报错内容:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.dao.B
解决方案:
把原本的sqlsessionfactory切换成mybatisPlus的
@Bean(name = "dataSqlSessionFactory")
public SqlSessionFactory clusterSqlSessionFactory(@Qualifier("dataDataSource") DataSource clusterDataSource)
throws Exception {
// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
// sessionFactory.setDataSource(clusterDataSource);
// sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
// .getResources(DataConfMysqlSourceConfig.MAPPER_LOCATION));
// org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
// configuration.setMapUnderscoreToCamelCase(true);
// sessionFactory.setConfiguration(configuration);
// return sessionFactory.getObject();
//
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
// 设置数据源
bean.setDataSource(clusterDataSource);
// 简化PO的引用
bean.setTypeAliasesPackage("com.**.**.entity");//这里我打码了,写你项目PO的包
// 设置全局配置
bean.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(DataConfMysqlSourceConfig.MAPPER_LOCATION));
return bean.getObject();
}