MybatisPlus BaseMapper 中的方法全部 Invalid bound statement (not found Error处理)

错误梗概

接手了一个新任务,需要修改别人的代码。看看数据库配置 ,连连接池都没,然后引入了 druid,本来一切很顺利。后来不知道怎么回事,运行起来后总是报 “Invalid bound statement (not found) ”,而且报错的都是 MybatisPlus 生成的 BaseMapper 中的方法,自己写的都能正常运行。

参考了很多其他帖子,都无果,最后弄了很久,终于搞定了,特级录之。

druid 和 mybatis-plus 配置参数如下:

pom.xml

<dependency>
  <groupId>com.alibaba</groupId>
  <artifactId>druid-spring-boot-starter</artifactId>
  <version>1.1.10</version>
 </dependency>

 <dependency>
  <groupId>com.baomidou</groupId>
  <artifactId>mybatis-plus-boot-starter</artifactId>
  <version>3.2.0</version>
 </dependency>

 <dependency>
  <groupId>com.github.pagehelper</groupId>
  <artifactId>pagehelper-spring-boot-starter</artifactId>
  <version>1.2.13</version>
  <exclusions>
  <exclusion>
   <artifactId>jsqlparser</artifactId>
   <groupId>com.github.jsqlparser</groupId>
  </exclusion>
  <exclusion>
   <artifactId>mybatis-spring</artifactId>
   <groupId>org.mybatis</groupId>
  </exclusion>
  </exclusions>
 </dependency>

application.properties

######################################################### MybatisPlus 配置
mybatis-plus.mapper-locations=classpath:mapper/*.xml
mybatis-plus.type-aliases-package=com.yishi.entity
mybatis-plus.global-config.db-config.table-underline=true
mybatis-plus.global-config.banner=false
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.configuration.jdbc-type-for-null=NULL
mybatis-plus.configuration.auto-mapping-behavior=FULL
######################################################### druid 配置
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# 参考 https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter
#################################### JDBC 配置
spring.datasource.druid.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.druid.url=${mysql.url}
spring.datasource.druid.username=${mysql.username}
spring.datasource.druid.password=${mysql.password}
#################################### 连接池配置
# 初始化大小,最小,最大
spring.datasource.druid.initial-size=10
spring.datasource.druid.max-active=500
spring.datasource.druid.min-idle=5
# 配置获取连接等待超时的时间
spring.datasource.druid.max-wait=60000
# 打开PSCache,并且指定每个连接上PSCache的大小
spring.datasource.druid.pool-prepared-statements=true
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
#spring.datasource.druid.max-open-prepared-statements= #和上面的等价
#spring.datasource.druid.validation-query=
#spring.datasource.druid.validation-query-timeout=
spring.datasource.druid.test-on-borrow=false
spring.datasource.druid.test-on-return=false
spring.datasource.druid.test-while-idle=true
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
spring.datasource.druid.time-between-eviction-runs-millis=60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
spring.datasource.druid.min-evictable-idle-time-millis=300000
#spring.datasource.druid.max-evictable-idle-time-millis=
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
spring.datasource.druid.filters=stat,wall,log4j
spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
spring.datasource.druid.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
#################################### 监控配置
# WebStatFilter配置,说明请参考Druid Wiki,配置_配置WebStatFilter
spring.datasource.druid.web-stat-filter.enabled=true
spring.datasource.druid.web-stat-filter.url-pattern=/*
spring.datasource.druid.web-stat-filter.exclusions=/druid/*,*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico
spring.datasource.druid.web-stat-filter.session-stat-enable=true
spring.datasource.druid.web-stat-filter.session-stat-max-count=10
#spring.datasource.druid.web-stat-filter.principal-session-name=
#spring.datasource.druid.web-stat-filter.principal-cookie-name=
#spring.datasource.druid.web-stat-filter.profile-enable=
# StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
spring.datasource.druid.stat-view-servlet.enabled=true
spring.datasource.druid.stat-view-servlet.url-pattern=/druid/*
spring.datasource.druid.stat-view-servlet.reset-enable=true
spring.datasource.druid.stat-view-servlet.login-username=admin
spring.datasource.druid.stat-view-servlet.login-password=admin
#spring.datasource.druid.stat-view-servlet.allow=
#spring.datasource.druid.stat-view-servlet.deny=

DruidDataSourceProperties

package com.yishi.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "spring.datasource.druid")
public class DruidDataSourceProperties {
 private String driverClassName;
 private String url;
 private String username;
 private String password;

 private int initialSize;
 private int minIdle;
 private int maxActive;
 private long maxWait;
 private long timeBetweenEvictionRunsMillis;
 private long minEvictableIdleTimeMillis;
 private String validationQuery;
 private boolean testWhileIdle;
 private boolean testOnBorrow;
 private boolean testOnReturn;
 private boolean poolPreparedStatements;
 private int maxPoolPreparedStatementPerConnectionSize;
 private String filters;
 private String connectionProperties;

 // 省略 get、set 方法
}

MysqlDruidConfiguration

package com.yishi.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;

import javax.sql.DataSource;
import java.sql.SQLException;

@Configuration
@EnableConfigurationProperties({DruidDataSourceProperties.class})
@MapperScan(value = MysqlDruidConfiguration.PACKAGE, sqlSessionFactoryRef = "mysqlSqlSessionFactory")
public class MysqlDruidConfiguration {

 static final String PACKAGE = "com.yishi.dao";

 static final String MAPPER_LOCATION = "classpath:mapper/*.xml";

 @Autowired
 private DruidDataSourceProperties properties;

 @Bean(name = "mysqlDataSource")
 @Primary
 public DataSource mysqlDataSource() {
 DruidDataSource druidDataSource = new DruidDataSource();
 druidDataSource.setDriverClassName(properties.getDriverClassName());
 druidDataSource.setUrl(properties.getUrl());
 druidDataSource.setUsername(properties.getUsername());
 druidDataSource.setPassword(properties.getPassword());
 druidDataSource.setInitialSize(properties.getInitialSize());
 druidDataSource.setMinIdle(properties.getMinIdle());
 druidDataSource.setMaxActive(properties.getMaxActive());
 druidDataSource.setMaxWait(properties.getMaxWait());
 druidDataSource.setTimeBetweenEvictionRunsMillis(properties.getTimeBetweenEvictionRunsMillis());
 druidDataSource.setMinEvictableIdleTimeMillis(properties.getMinEvictableIdleTimeMillis());
 druidDataSource.setValidationQuery(properties.getValidationQuery());
 druidDataSource.setTestWhileIdle(properties.isTestWhileIdle());
 druidDataSource.setTestOnBorrow(properties.isTestOnBorrow());
 druidDataSource.setTestOnReturn(properties.isTestOnReturn());
 druidDataSource.setPoolPreparedStatements(properties.isPoolPreparedStatements());
 druidDataSource.setMaxPoolPreparedStatementPerConnectionSize(properties.getMaxPoolPreparedStatementPerConnectionSize());
 druidDataSource.setConnectionProperties(properties.getConnectionProperties());
 try {
  druidDataSource.setFilters(properties.getFilters());
  druidDataSource.init();
 } catch (SQLException e) {
  e.printStackTrace();
 }

 return druidDataSource;
 }

 @Bean(name = "mysqlTransactionManager")
 @Primary
 public DataSourceTransactionManager mysqlTransactionManager() {
 return new DataSourceTransactionManager(mysqlDataSource());
 }

 @Bean(name = "mysqlSqlSessionFactory")
 @Primary
 public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSource") DataSource mysqlDataSource)
  throws Exception {
 final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
 sessionFactory.setDataSource(mysqlDataSource);
 sessionFactory.setMapperLocations(
  new PathMatchingResourcePatternResolver().getResources(MysqlDruidConfiguration.MAPPER_LOCATION));
 return sessionFactory.getObject();
 }

 @Bean(name = "mysqlJdbcTemplate")
 public JdbcTemplate hiveJdbcTemplate(@Qualifier("mysqlDataSource") DataSource dataSource) {
 return new JdbcTemplate(dataSource);
 }
}

开发环境

IDEA 2020.2
Apache Maven 3.2.5
主要库版本:
org.springframework.boot.spring-boot-dependencies.2.1.1.RELEASE
com.baomidou.mybatis-plus-boot-starter.3.2.0
com.alibaba.druid-spring-boot-starter.1.1.10

异常信息

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yishi.dao.UserDao.selectList
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53)
	at org.apache.ibatis.binding.MapperProxy.lambda$cachedMapperMethod$0(MapperProxy.java:98)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:97)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:92)
	at com.sun.proxy.$Proxy105.selectList(Unknown Source)
	at com.yishi.impl.UserServiceImpl.insert(UserServiceImpl.java:104)
	at com.yishi.impl.UserServiceImpl.insert(UserServiceImpl.java:39)
	at com.yishi.impl.UserServiceImpl$$FastClassBySpringCGLIB$$ac0e5ea9.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.yishi.impl.UserServiceImpl$$EnhancerBySpringCGLIB$$c9a67874.insert(<generated>)
	at com.yishi.controller.UserController.add(UserController.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

解决方式

一开始没打开 Debug 日志,导致很多 Debug 的信息都没法及时捕获,打开 Debug 日志后,WARN 如下:

2020-09-01 10:02:15 [restartedMain] WARN  o.m.s.m.ClassPathMapperScanner - Skipping MapperFactoryBean with name 'userDao' and 'com.yishi.dao.UserDao' mapperInterface. Bean already defined with the same name!

...

2020-09-01 10:02:15 [restartedMain] WARN  o.m.s.m.ClassPathMapperScanner - No MyBatis mapper was found in '[com.yishi.dao]' package. Please check your configuration.

可以看到,在注入 dao 时说已经存在了,难怪 Mybatis-Plus 生成的 BaseMapper 所有方法报错,压根就没注入。那什么地方先注入了呢?看来看去,原来是在 MysqlDruidConfiguration.java 这个类在自动配置时配置 “mysqlSqlSessionFactory” 这个 bean 时已经先注入 dao 相关的信息!

最后解决方式,删掉 MysqlDruidConfiguration.java 和 DruidDataSourceProperties.java这两个类,springboot 都已经帮我们处理了 druid 的配置,其实这两个类也没什么用。

总结

到此这篇关于MybatisPlus BaseMapper 中的方法全部 Invalid bound statement (not found Error处理)的文章就介绍到这了,更多相关MybatisPlus BaseMapper内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • SpringBoot集成MybatisPlus报错的解决方案

    这篇文章主要介绍了SpringBoot集成MybatisPlus报错的解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 问题 启动的时候总是报如下错误: java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class 解决方案 需要一个mybatis-spring-boot-starter的包,在pom文件加上之后,完

  • Mybatis plus中使用in查询出错如何解决

    不想看我bb的直接点上面的 ''解决方法'' 我的情况是这样的,在使用mybatis plus提供的QueryWrapper方法里的in查询时,我的参数为类似"1,2,3,4"这样的字符串 //要查的参数 String masterIds = "81554,5654,55948,48945"; QueryWrapper<FpjyPauperInfo> pauperqw = new QueryWrapper<>(); pauperqw.in(&

  • Mybatis-Plus BaseMapper的用法详解

    1.如何使用BaseMapper进行数据库的操作. 2.使用BaseMapper进行插入实体时如何让UUID的主键自动生成. Student实体类,其中id属性主键为UUID package com.huixiaoer.ant.api.model.bean; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; public class Stud

  • MybatisPlus BaseMapper 中的方法全部 Invalid bound statement (not found Error处理)

    错误梗概 接手了一个新任务,需要修改别人的代码.看看数据库配置 ,连连接池都没,然后引入了 druid,本来一切很顺利.后来不知道怎么回事,运行起来后总是报 "Invalid bound statement (not found) ",而且报错的都是 MybatisPlus 生成的 BaseMapper 中的方法,自己写的都能正常运行. 参考了很多其他帖子,都无果,最后弄了很久,终于搞定了,特级录之. druid 和 mybatis-plus 配置参数如下: pom.xml <d

  • 解决mybatis-plus通用mapper调用报错:Invalid bound statement

    目录 mybatis-plus通用mapper调用报错 解决方法 mybatis-plus通用mapper调用报错 使用springboot整合mybatis-plus后,调用自定义的方法正常,调用BaseMapper中自带的方法报错如下: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.rkang.enterprise.mapper.EmployeeInfoMapper.se

  • mybatisplus报Invalid bound statement (not found)错误的解决方法

    搭建项目时使用了mybatisplus,项目能够正常启动,但在调用mapper方法查询数据库时报Invalid bound statement (not found)错误. 以下为项目配置 pom文件 <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-extension</artifactId> <version>3.3.0</versio

  • 引入mybatis-plus报 Invalid bound statement错误问题的解决方法

    错误 Mybatis-Plus (简称MP) 是mybatis的一个增强工具,在mybatis的基础上只做增强不做改变,简化了开发效率.其实就是帮我们封装了一些简单的curd方法,可以直接调用,不必再重写这些简单的sql语句,类似JPA那样. 前两天创建了一个新项目,持久层框架用的是mybatis,同时引入mybatis-plus做增强工具,项目启动后,调用接口却发现报错了,报错的提醒如下: 错误的信息显示的是 "无效的绑定语句",报错的地方正是操作sql语句的方法,从网上查了一下答案

  • 使用mybatis-plus报错Invalid bound statement (not found)错误

    近期使用Springboot集成Mybatisplus,执行insert时一直报错,提示错误如下: Invalid bound statement (not found): xx.insert mapper继承BaseMapper: BaseMapper有insert方法如下: service调用mapper.insert(对象)报错 某度查找资料均不能解决问题,最终经查阅官方文档比对得知是缺少jar包导致.在pom.xml中引入: <dependency> <groupId>co

  • SpringBoot使用MyBatis-Plus解决Invalid bound statement异常

    目录 前言 缘由 解决问题 总结 前言 本篇文章主要介绍关于我在SpringBoot中使用MyBatis-Plus是如何解决Invalid bound statement (not found)这个异常的.我先抛一些我在这个途中遇到的一些问题,看看各位了解不了解. 当Mybatis的xml文件不在resouce下时该如何配置. 如何去指定mapper-Location的配置. classpath*跟classpath的区别是啥 Invalid bound statement (not found

  • MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决方法

    如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上. 按以下步骤一一执行: 1.检查xml文件所在的package名称是否和interface对应的package名称一一对应 2.检查xml文件的namespace是否和xml文件的package名称一

  • 解决Maven项目中 Invalid bound statement 无效的绑定问题

    问题 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 关于这个问题,我的是 Maven 项目,在访问程序的接口时,抛出异常信息,无效的绑定语句. 在检查调用的 Mapper 接口时,发现在目标文件中没有找到 Mapper 映射的配置文件,在项目的 target 目标文件中可以看到,与接口对应的 Mapper 文件未加载,所以在程序启动时,就找不到对应的映射文件,导致的这个错误. 解决

  • 详解Mybatis-plus(MP)中CRUD操作保姆级笔记

    目录 一.什么是mybatis-plus 1.在java中访问数据库 2.Mybatis-plus简介 3.Mybatis-plus特性 二.第一个mybatis-plus开发 1.使用MP的步骤: 前提:数据库/表创建 2.mybatis-plus日志 三.MP操作CRUD 的 基本用法 1.添加数据后,获取主键值(MP可以自动实现主键回填) 2.更新数据 3.删除数据 4.查询数据 5.mybatis-plus中CRUD的底层实现原理 一.什么是mybatis-plus 1.在java中访问

  • Mybatis-Plus中updateById方法不能更新空值问题解决

    目录 问题描述 演示: 原因分析: 解决方案: 1.设置字段级别的更新策略IGNORED 2.设置全局更新策略IGNORED 3.采用alwaysUpdateSomeColumnById方法进行全字段更新 小结: 问题描述 在Mybatis-Plus中调用updateById方法进行数据更新默认情况下是不能更新空值字段的.而在实际开发过程中,往往会遇到需要将字段值更新为空值的情况.那么如果让Mybatis-Plus中的updateById方法支持空值更新呢? 演示: 实体User: @Table

随机推荐