解決org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xyfer.dao.UserDao.findById

来源:https://www.cnblogs.com/xyfer1018/archive/2019/09/02/11450475.html
-Advertisement-
Play Games

在使用Spring整合MyBatis的時候遇到控制台報錯:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xyfer.dao.UserDao.findById 詳細信息如下: 這 ...


  在使用Spring整合MyBatis的時候遇到控制台報錯:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xyfer.dao.UserDao.findById

  詳細信息如下:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xyfer.dao.UserDao.findById

    at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225)
    at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
    at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
    at com.sun.proxy.$Proxy12.findById(Unknown Source)
    at UserDaoTest.test(UserDaoTest.java:17)
    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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

  這個問題總結如下:

1、仔細檢查mapper.xml中的namesapce是否為dao層相應介面的全類名;

2、仔細檢查mapper.xml中sql語句的id和dao層相應介面中的方法名稱是否一致,包括參數類型、parameterType、resultType、resultMap是夠一致;

3、application.xml中或者mybatis.xml中配置mapper文件的路徑和映射介面類的包名是否正確:

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • [TOC] 題目 "CF448D Multiplication Table" 思路 二分答案,每一排都是遞增的,所以二分$ans$,去計算有多少個數和$ans$相等,有多少個數比$ans$小,如果小於$ans$的數少於$k$個並且小於等於$ans$的數大於等於$k$個,那麼當前$ans$就是答案。 ...
  • “猴子補丁”就是指,在函數或對象已經定義之後,再去改變它們的行為。 舉個例子: import datetime datetime.datetime.now = lambda: datetime.datetime(2012, 12, 12) 大部分情況下,這是種很不好的做法 - 因為函數在代碼庫中的行 ...
  • getpwname只能得到gid一個username。 getgroups只能獲取groups腳本用戶。 我怎麼能得到所有groups的任意一個username,比如id -Gn命令? 解決方案 本文首發於Python黑洞網,博客園同步更新 ...
  • 又拾起了rust語言, 想寫一點東西玩一玩, 但是發現連一個獲取本機IP地址的庫都沒有, 還得輓起袖子自己擼. https://crates.io/crates/local_ipaddress 沒有用ifconfig, 也沒有掃描網卡, 就開了一個UdpSocket嘗試著去連一個IP地址, 然後看本 ...
  • JVM調優的目的是保證在**一定吞吐量**的情況下儘可能的**減少GC次數**,從而減少系統停頓時間,提高服務質量和效率。 ...
  • 使用一個polygon矢量提取某個文件夾中所有的tif格式柵格數據 (要確保先安裝好arcpy包) 2019-09-02 23:53:36 ...
  • Java練習——撲克牌發牌器聲明:學習自其他博主,感謝分享,這裡自己也寫了一下。實現思路 - 構建一張撲克牌 - 構建一套撲克牌 - 測試 構建一張撲克牌 構建一套撲克牌 測試 結果: 玩家1紅桃6 方塊4 方塊A 黑桃4 草花2 紅桃Q 紅桃J 紅桃K 方塊3 黑桃K 方塊8 黑桃7 黑桃5 玩家 ...
  • 資料庫連接池原理-傳統方式 當有多個線程,每個線程都需要連接資料庫執行SQL語句的話,那麼每個線程都會創建一個連接,並且在使用完畢後,關閉連接。創建連接和關閉連接的過程也是比較消耗時間的,當多線程併發的時候,系統就會變得很卡頓。同時,一個資料庫同時支持的連接總數也是有限的,如果多線程併發量很大,那麼 ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...