记录一个Invalid bound statement (not found)问题

news2024/11/29 22:30:42

SpringBoot+MyBatisPlus项目,非常简单,没有任何业务逻辑:

1. pom文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.12</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>org.yh.mall</groupId>
    <artifactId>mall-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>mall-server</name>
    <description>mall-server</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-groovy-templates</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.3.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.2.18</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.8.19</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <!--指定资源的位置(xml放在resources下,可以不用指定)-->
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
    </build>

</project>

2. 启动类

package gov.yh.mall;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan(basePackages = {"gov.yh.mall"})
public class MallServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(MallServerApplication.class, args);
    }

}

3. Controller

package gov.yh.mall.controller;

import gov.yh.mall.common.api.ApiResp;
import gov.yh.mall.service.CategoryService;
import gov.yh.mall.vo.CategoryTreeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/category")
@RestController
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/tree")
    public ApiResp<CategoryTreeVo> tree() {
        return ApiResp.ok(categoryService.listTree());
    }
}

4. Service接口

package gov.yh.mall.service;

import com.baomidou.mybatisplus.extension.service.IService;
import gov.yh.mall.domain.Category;
import gov.yh.mall.vo.CategoryTreeVo;

public interface CategoryService extends IService<Category> {
    CategoryTreeVo listTree();
}

5. Service实现

package gov.yh.mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import gov.yh.mall.domain.Category;
import gov.yh.mall.mapper.CategoryMapper;
import gov.yh.mall.service.CategoryService;
import gov.yh.mall.vo.CategoryTreeVo;
import org.springframework.stereotype.Service;

@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {

    @Override
    public CategoryTreeVo listTree() {
        return null;
    }
}

6. 数据库模型

package gov.yh.mall.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public abstract class BaseDomain implements Serializable {
    private static final long serialVersionUID = -4103484210920857803L;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime updateTime;
    private String delFlag;
    private Boolean status;
}
package gov.yh.mall.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import gov.yh.mall.common.utils.GenericListJsonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@TableName("mall_category")
public class Category extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 8072944985574611728L;

    @TableId
    private Integer categoryId;
    private Integer parentId;
    @TableField(typeHandler = GenericListJsonTypeHandler.class)
    private List<Long> categoryPath;
    private String categoryName;
}

7. DAO接口

package gov.yh.mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import gov.yh.mall.domain.Category;
import org.springframework.stereotype.Repository;

@Repository
public interface CategoryMapper extends BaseMapper<Category> {
}

与 mapper对应的xml放在resources/mapper目录中

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="gov.yh.mall.mapper.CategoryMapper">

</mapper>

 8. 数据库表

CREATE TABLE `mall_category` (
  `category_id` int(20) NOT NULL COMMENT 'ID',
  `parent_id` int(20) DEFAULT NULL COMMENT '父级ID',
  `category_path` json DEFAULT NULL COMMENT '类别全路径',
  `category_name` varchar(30) COLLATE utf8mb4_bin NOT NULL COMMENT '类别名称',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0' COMMENT '是否删除',
  `status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否启用的状态',
  PRIMARY KEY (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='商品类目';

9. 视图层模型

package gov.yh.mall.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class CategoryItem implements Serializable {
    private static final long serialVersionUID = -251944196849206041L;
    private Integer categoryId;
    private Integer parentId;
    private String categoryName;
}
package gov.yh.mall.vo;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class CategoryTreeVo extends CategoryItem implements Serializable {
    private static final long serialVersionUID = -5372664435944643984L;

    private List<CategoryTreeVo> children;
}

10. 工具类

package gov.yh.mall.common.utils;

import cn.hutool.json.JSONUtil;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;

import java.io.Serializable;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * JSON字段处理器,列表型数据
 *
 */
public class GenericListJsonTypeHandler<T extends Serializable> extends BaseTypeHandler<List<T>> {
    private final Class<T>     clazz;

    public GenericListJsonTypeHandler(Class<T> clazz) {
        if (clazz == null) {
            throw new IllegalArgumentException("Type argument cannot be null");
        }
        this.clazz = clazz;
    }

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, List<T> parameter, JdbcType jdbcType) throws SQLException {
        ps.setString(i, JSONUtil.toJsonStr(parameter));
    }

    @Override
    public List<T> getNullableResult(ResultSet rs, String columnName) throws SQLException {
        return this.toObject(rs.getObject(columnName), clazz);
    }

    @Override
    public List<T> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
        return this.toObject(rs.getObject(columnIndex), clazz);
    }

    @Override
    public List<T> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
        return this.toObject(cs.getObject(columnIndex), clazz);
    }

    private List<T> toObject(Object content, Class<T> clazz) {
        if (content == null) {
            return null;
        }
        return JSONUtil.toList(content.toString(), clazz);

    }
}

11. 配置文件

11.1 application.yml

server:
  servlet:
    encoding:
      charset: UTF-8
      enabled: true

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
  aop:
    proxy-target-class: true
    auto: true
  # 时间戳统一转换
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8

mybatis-plus:
  mapper-locations: classpath:/mapper/**/*.xml
  type-aliases-package: com.wasu.mall
  configuration:
    # 驼峰转换 从数据库列名到Java属性驼峰命名的类似映射
    map-underscore-to-camel-case: true

11.2 application-dev.yml

server:
  port: 10900

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/san-zhi?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true
    username: root
    password: 123456
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      # druid监控全局配置
      filter:
        stat:
          log-slow-sql: true
          slow-sql-millis: 1000
          merge-sql: false
        wall:
          config.multi-statement-allow: true
      min-evictable-idle-time-millis: 300000
      test-on-borrow: false
      test-on-return: false
      initial-size: 10
      min-idle: 10
      max-wait: 60000
      pool-prepared-statements: true
      test-while-idle: true
      validation-query: select 1
      time-between-eviction-runs-millis: 60000
      max-pool-prepared-statement-per-connection-size: 20
      max-active: 100
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
  # redis 配置
  redis:
    host: 47.108.114.216
    port: 6379
    database: 1
    password: fB5LX@NyFI
    lettuce:
      pool:
        max-active: 8
        max-idle: 8
        min-idle: 0
        max-wait: 100ms

# 配置MyBatis日志
mybatis-plus:
  configuration:
    # 打印sql
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

12. 单元测试

package gov.yh.mall.mapper;

import cn.hutool.json.JSONUtil;
import gov.yh.mall.domain.Category;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import java.util.List;

@SpringBootTest
@ActiveProfiles({"dev"})
public class CategoryMapperTest {
    @Autowired
    private CategoryMapper categoryMapper;

    @Test
    public void testCategory() {
        List<Category> categories = categoryMapper.selectList(null);
        System.out.println(JSONUtil.toJsonPrettyStr(categories));
    }
}

 13. 项目结构

 

14. 问题表现

执行时,激活dev配置文件

        请求接口/category/1,会调用CategoryController的getById方法,不调用CategoryService,调用成功

        执行单元测试CategoryMapperTest,不调用CategoryService,直接调CategoryMapper,调用成功,没有任何错误

        请求接口/category/tree,会调用CategoryController的tree方法,进而调用categoryService.listTree(),就会报错

2023-06-07 14:38:10.189 ERROR 34416 --- [io-10900-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): gov.yh.mall.service.CategoryService.listTree] with root cause

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): gov.yh.mall.service.CategoryService.listTree
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235) ~[mybatis-3.5.10.jar:3.5.10]
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:50) ~[mybatis-plus-core-3.5.3.1.jar:3.5.3.1]
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedInvoker$0(MybatisMapperProxy.java:111) ~[mybatis-plus-core-3.5.3.1.jar:3.5.3.1]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_302]
	at com.baomidou.mybatisplus.core.toolkit.CollectionUtils.computeIfAbsent(CollectionUtils.java:115) ~[mybatis-plus-core-3.5.3.1.jar:3.5.3.1]
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedInvoker(MybatisMapperProxy.java:98) ~[mybatis-plus-core-3.5.3.1.jar:3.5.3.1]
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.3.1.jar:3.5.3.1]
	at com.sun.proxy.$Proxy77.listTree(Unknown Source) ~[na:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_302]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_302]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_302]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_302]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.3.27.jar:5.3.27]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-5.3.27.jar:5.3.27]
	at com.sun.proxy.$Proxy79.listTree(Unknown Source) ~[na:na]
	at gov.yh.mall.controller.CategoryController.tree(CategoryController.java:29) ~[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_302]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_302]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_302]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_302]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.27.jar:5.3.27]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:529) ~[tomcat-embed-core-9.0.75.jar:4.0.FR]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.27.jar:5.3.27]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) ~[tomcat-embed-core-9.0.75.jar:4.0.FR]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.27.jar:5.3.27]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.27.jar:5.3.27]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.27.jar:5.3.27]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.27.jar:5.3.27]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.27.jar:5.3.27]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.27.jar:5.3.27]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.75.jar:9.0.75]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_302]

15. 强调一下

  1. SpringBoot2+MyBatisPlus+Druid的一个常规工程,没有任何config配置(参见项目结构截图)
  2. 网上各种Invalid bound statement (not found)的错误都查过了,什么改pom中的依赖、build选项、改mapper扫描位置和mapper-locations(见主启动类和配置文件)等等的,都试过了,没用
  3. 工程启动没问题,只要不调用CategoryService,就能成功,一调用这个CategoryService,就失败了,我反复对比了半天这个CategoryService,也没发现问题出在哪里。

总之,不知道哪里不对了,就一直有这个Invalid bound statement (not found),请大神给指点一下,到底哪里出问题了。

代码已经上传到Gitee了,地址:mall-check: 一个有问题的代码仓库

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/619945.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Windows定时执行Python脚本

在Linux环境下我们可以使用crontab工具来定时的执行脚本&#xff0c;可以很轻松的管理各个虚拟环境下的py文件在Windows上可以使用任务计划程序来定时执行我们的脚本 关于这个的基本使用可以查看我前面的博客 https://blog.csdn.net/wyh1618/article/details/125725967?spm10…

单片机编程小错记录1:漏写串口中断服务函数

问题描述&#xff1a; 原本单独测试没问题的定时器程序&#xff0c;但在加上串口程序后出现了问题&#xff0c;发现定时器貌似没有在正常工作...... 问题发现&#xff1a; 程序如下&#xff1a; 该程序主要想实现的功能是&#xff1a; 1.串口在初始化时发送"welcome\r…

crossover软件2023跨电脑系统兼容工具好用吗?

CrossOver是一款系统兼容软件 让您可以在 Mac 和 Linux 系统上运行 Windows 应用&#xff0c;不必购买 Windows授权&#xff0c;不必重启系统&#xff0c;不必使用虚拟机。通过 CrossOver&#xff0c; 您可以从 dock 直接启动 Windows 应用&#xff0c;与您的 Mac 和 Linux 系统…

Java中this和super区别(面试题)

1.super 关键字可以理解为&#xff1a;父类的 2.可以用来调用的结构&#xff1a;属性、方法、构造器 3.super调用属性、方法&#xff1a; 3.1 我们可以在子类的方法或构造器中。通过使用"super.属性"或"super.方法"的方式&#xff0c;显式的调用父类中声…

每日一练 | 华为认证真题练习Day54

1、现有一台交换机通过一个端口和对端设备的指定端口直连&#xff0c;但是该端口不转发任何报文&#xff0c;却可以通过接收BPDU来监听网络变化&#xff0c;那么该端口的角色应该是&#xff08;&#xff09;。 A. Root端口 B. Designated端口 C. Alternate端口 D. Disable端…

day1 计算机硬件基础

目录 课程回顾 嵌入式系统分层 ARM体系结构与接口技术 计算的组成 总线 CPU工作概述 课程回顾 嵌入式系统分层 操作系统的作用&#xff1a; 向下管理硬件、向上提供接口&#xff08;API&#xff09; Linux子系统&#xff1a; 进程管理&#xff1a;管理进程的创建、调度…

【MySQL数据库 | 第二篇】 启动与停止

目录 ​编辑 &#x1f914; 启动与停止&#xff1a; &#x1f642;1.WIN加R调用windows命令行&#xff0c;输入&#xff1a;services.msc &#x1f642;2.可以在cmd&#xff08;管理员模式&#xff09;中输入以下指令&#xff1a; &#x1f914; 启动MySQ后的操作步骤&…

Es elasticsearch 十九 kibana 可视化配置图表 及功能 集群部署

目录 Es kibana 可视化 下载zip 解压 bin/kibana.bat 启动 管理索引管理 吧logstash 存进来的数据 按照 xxx-* 方式 保存索引模式 通过 discove 配置可视化界面 图表数据实时刷新 时序图配置 饼图配置 表格数据配置 添加仪表盘 图表样例 使用后模拟绘制方法好看些 …

线程的相关函数pthread

一、线程相关函数 头文件&#xff1a;#include <pthread.h> 注意&#xff1a;在编译时注意加上-lpthread参数&#xff0c;以调用静态链接库。因为pthread并非linux系统的默认库。 1、pthread_create 函数声明&#xff1a;int pthread_create(pthread_t *thread, const…

这所院校复试只刷低分,有9人擦线竟直接放弃复试!

本期为大家整理唯一个处于东部发达地区入选“双一流建设”的原双非类的综合类大学-“宁波大学”的择校分析&#xff0c;这个择校分析专题会为大家结合&#xff1a;初试复试占比、复试录取规则&#xff08;是否公平&#xff09;、往年录取录取名单、招生人数、分数线、专业课难度…

kubelet源码分析 kuberuntime的syncpod、createSandbox/createContainer函数(三)

kubelet源码分析 kuberuntime的syncpod、createSandbox/createContainer函数&#xff08;三&#xff09; 上一篇介绍了killContainer容器部分。当kill后&#xff0c;就需要重新创建sandbox和container&#xff0c;今天介绍最后一部分&#xff0c;创建容器。 这篇也是整个上面的…

通达信自动包络线指标公式以及ATR通道指标

根据亚历山大埃尔德在其著作《以交易为生》中的描述&#xff0c;自动包络线的设计思路是将通道看作试穿衬衫一样&#xff0c;寻找那些穿起来既不过松也不过紧的衬衫&#xff0c;只让手腕和脖子露在外面。自动包络线能够适应最近的行情波动&#xff0c;只有在极端情况下&#xf…

修电脑屏幕记

21年的时候媳妇买了台联想小新16Pro&#xff0c;最近发现屏幕闪&#xff0c;查了查售后政策&#xff0c;好在屏幕质保两年。 找维修点 从高德地图里搜联想售后很正常吧&#xff01;看看图片带着Lenovo的图片&#xff0c;是不是感觉是官方售后&#xff1f;拨打电话打到的是总部…

AI生成的二维码,真的太好看了!

今天我们迫不及待要和大家分享一组图片。 这是一位二维码开发者——倪豪 Isle of Chaos&#xff0c;与几位同学和老师们一起&#xff0c;使用最新的AI技术生成的非常惊艳的图片。最重要的是&#xff0c;这些图片里面都暗藏了一个可识别的二维码&#xff01; 总之&#xff0c;…

回归分析处理

线性回归 最小二乘法 对于某数据量 有呈线性关系的输出量 &#xff0c;且 &#xff0c;现有对这些数据量的采集序列&#xff0c;这些采集量会存在随机误差&#xff0c;线性回归的目的便是找到保证使误差最小的情况下的回归系数 。 即通过下列方程组求 可利用最小二乘法&a…

SaaS行业的公司为什么都需要一个专业的知识库

随着云计算和人工智能技术的不断发展&#xff0c;SaaS&#xff08;Software as a Service&#xff09;模式已经成为了企业信息化转型的必备选择。SaaS 公司提供的服务可以帮助客户在不增加IT投资的情况下&#xff0c;获得更为高效灵活的IT解决方案。但随着客户数量和服务类型的…

Windows下的网络编程Winsock

文章目录 前言1、服务器下的Winsock1.1、构建编程环境:1.2、WSAData结构体1.3、WSAStartup初始化Winsock1.4、WSACleanup释放Winsock1.5、socket创建套接字1.6、bind绑定套接字&#xff0c;调用其分配IP地址和端口号1.7、listen监听套接字1.8、accept接受客户端连接请求1.9、cl…

k8s helm安装使用

1.前言 Helm 是一个 Kubernetes 包管理工具&#xff0c;它的作用是简化 Kubernetes 应用程序的部署和管理。Helm 允许您将 Kubernetes 应用程序打包为 chart&#xff0c;chart 是一组预定义的 Kubernetes 对象模板&#xff0c;包括 Deployment、Service、Ingress 等。使用 Hel…

python中文情感分析---基于包含分数的情感词典实现对于各语句的情感分析的方案

一、详情简介: 1.此文主要研究方向为:基于包含分数的情感词典实现对于各语句的情感分析&#xff1b; 2.情感分析主要基于文本数据&#xff0c;是自然语言处理&#xff08;NPL&#xff09;的主要内容。情感分析&#xff1a;又称意见挖掘、倾向性分析等。简单而言,是对带有情感…

Unity中的【Dropdown(包括TMP_Dropdown)下拉框当只有一个下拉值时多次点击 OnValueChange事件无效】的改进方法

Dropdown(包括TMP_Dropdown)下拉框当只有一个下拉值时&#xff0c;多次点击下拉框&#xff0c;并选择选项时&#xff0c; OnValueChange事件不响应 一、下拉框提供了一个【onValueChance】的事件接口 当下拉框值变化的时候&#xff0c;代表用户选择了新的值&#xff0c;于是执…