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
說明文檔進行操作。