org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

调用mybatis-plus框架中的selectList方法

  1. 文件名没有问题

  2. 引用的包没有问题

  3. mapper没有问题

  4. 怎么都找不到问题

项目使用了双数据源配置

  1. 去除另外一个配置的 @Primary
  2. 修改sqlSessionFactory方法
@Bean(name = "sqlSessionFactory")
    public SqlSessionFactory testSqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception {
        // 设置数据源
        MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
        mybatisSqlSessionFactoryBean.setDataSource(dataSource);
        //mapper的xml文件位置
        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        String locationPattern = "classpath*:/mapper/m1/*.xml";
        mybatisSqlSessionFactoryBean.setMapperLocations(resolver.getResources(locationPattern));
        //对应数据库的entity位置
        String typeAliasesPackage = "com.local.native.entity";
        mybatisSqlSessionFactoryBean.setTypeAliasesPackage(typeAliasesPackage);
        mybatisSqlSessionFactoryBean.setDataSource(dataSource());
        return mybatisSqlSessionFactoryBean.getObject();
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值