org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.prepared.mapper.UserMapper.selectList
除了mapper.xml文件对应的实体不对,或者mapper.java文件地址不对,id不对之外。还有可能是,mybatis-plus和spring自带的mybatis框架冲突。
或者你如果使用mybatis扫描mapper的话,service就算你继承了mybatis-plus的IService也不能实现对应的功能。
所以,需要删除springbot自带的mybatis集成包。
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
第二点:要是用mybatis-plus
就要使用mybatis-plus
扫描mapper。
需要使用mybatis-plus
的扫描。
package com.prepared.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
/**
* [@author](https://my.oschina.net/arthor) miemie
* [@since](https://my.oschina.net/u/266547) 2018-08-10
*/
@Configuration
@MapperScan("com.prepared.mapper")
public class MybatisPlusConfig {
}
所以,如果你要使用mybatis-plus
,那么请删除springbot自带的集成包,按照mybatis-plus
说明文档进行操作。