mybatisplus报 Invalid bound statement (not found):

这里只介绍一下我的情况,一个很低级的错误

mybatis-plus: # mybatis将代码都托管到了github上,因此我们可以在github上找主配置文件和mapperxml文件的模板内容
  configLocation: classpath:mybatis_config/mybatis-config.xml # mybatis主配置文件的问题
  #mapper-locations: classpath:mapper/*.xml # 指定mapperxml 文件位置

错误的原因是上面配置注释掉的那部分,一般情况我们不用配置这一项,因为mybatis-plus的自动配置中有,如下:

@Data
@Accessors(chain = true)
@ConfigurationProperties(prefix = Constants.MYBATIS_PLUS)
public class MybatisPlusProperties {

    private static final ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();

    /**
     * Location of MyBatis xml config file.
     */
    private String configLocation;

    /**
     * Locations of MyBatis mapper files.
     *
     * @since 3.1.2 add default value
     */
    private String[] mapperLocations = new String[]{"classpath*:/mapper/**/*.xml"};

可以看到他默认指定的mapper.xml文件的位置是resources下的mapper文件夹下的任意路径下的xml文件,而我上面错误的配置是只找到了mapper文件夹下的xml,而mapper文件夹下的其他文件夹的xml读不到。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值