Table of contents
Error message
When using SpringBoot to integrate mybatisplus, this error was discovered during joint debugging of the database and controller.
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atdession.service.UserService.getBaseMapper
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235) ~[mybatis-3.5.9.jar:3.5.9]
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:50) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedInvoker$0(MybatisMapperProxy.java:111) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_362]
at com.baomidou.mybatisplus.core.toolkit.CollectionUtils.computeIfAbsent(CollectionUtils.java:115) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedInvoker(MybatisMapperProxy.java:98) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at com.sun.proxy.$Proxy57.getBaseMapper(Unknown Source) ~[na:na]
at com.baomidou.mybatisplus.extension.service.IService.getById(IService.java:292) ~[mybatis-plus-extension-3.5.1.jar:3.5.1]
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) ~[na:1.8.0_362]
wrong reason
MapperScan scans to the specified package
@SpringBootApplication
#错误:要扫描指定的mapper包下
@MapperScan(basePackages = "com.atdession")
public class BillMain {
public static void main(String[] args) {
SpringApplication.run(BillMain.class,args);
}
}
solve
Because my MapperScan scan is a full scan, just specify MapperScan to scan the Mapper package.
@SpringBootApplication
@MapperScan(basePackages = "com.atdession.mapper")
public class BillMain {
public static void main(String[] args) {
SpringApplication.run(BillMain.class,args);
}
}
Solved