MyBatis-Plus 配置多数据源自带CRUD接口报错- Invalid bound statement (not found):

@Bean(name = "sqlSessionFactory.xx")
public SqlSessionFactory sqlSessionFactory(@Qualifier("datasource.motorbike") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
org.apache.ibatis.session.Configuration configuration = new MybatisConfiguration();
//读取null值设置
configuration.setCallSettersOnNulls(true);
bean.setConfiguration(configuration);
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/xx/*.xml"));

return bean.getObject();
}

注意标红这俩对象,都要使用MyBatis-Plus提供的类
posted @ 2021-09-08 16:42  尼玛范爷  阅读(274)  评论(0编辑  收藏  举报