關於IDEA工具在springboot整合mybatis中出現的Invalid bound statement (not found)問題
第一次寫部落格。有點小激動。
筆者因為工作需要,所以需要學習springboot和springcloud,而開發工具則是公司要求使用的IDEA2017,筆者之前的開發工具是Myeclipse.
換了工具有諸多的不適應,還在慢慢的熟悉
在學習過程中難免有些磕磕碰碰,幾天下來碰到了N個問題
一直有個想法,想把學習與工作過程中的錯誤與靈感都記錄下來,卻一直苦於沒有什麼時間而沒去動筆
今天在學習springboot與mybatis整合中,使用了註解+xml的開發.
pom.xml引的幾個重要依賴
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.10.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> <version>1.5.6.RELEASE</version> </dependency>
這是筆者的介面mapper
@Mapper
public interface UserMapper {
List<User> likeName(String name);
User getById(Integer id);
}
這是xml檔案
<?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="com.example.demo.UserMapper"> <resultMap id="userMap" type="com.example.demo.User"> <id property="id" column="id" /> <result property="name" column="name" /> <result property="age" column="age" /> </resultMap> <select id="getById" resultMap="userMap" parameterType="int"> SELECT * FROM USER WHERE ID = #{id} </select> </mapper>
測試檔案
@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = DemoApplication.class) public class MybatisTest { @Autowired private UserMapper userMapper; @Test public void getById() throws Exception { User user = userMapper.getById(1); System.out.println(user); } }
在一切準備就緒之後,測試test,卻出現了org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
這個問題,通常情況下,這是xml檔案與介面mapper不對應導致的. 但我仔細檢查了一遍,沒有發現錯誤.
在查閱過相關資料後發現,IDEA對xml檔案處理的方式不同. mapper.xml檔案需要放置在resource這個資料夾下.
而eclipse只要mapper介面檔案與mapper.xml放置在同一平級目錄就行
相關推薦
IDEA中spring boot MyBatis出現Invalid bound statement (not found)錯誤
同樣的專案在eclipse中沒有問題在idea中mybatis會報Invalid bound statement (not found)錯誤 原因是沒有找到相對應的XML檔案,找了很長時間發現在編譯後的classes路徑下並沒有相應的XML檔案,這是因為IDEA在編譯的時候
在使用mybatis的selectFromExample時出現Invalid bound statement (not found)錯誤
oca ror jdk filter tro lec ces hint nco 主要原因:運行項目在構建的時候只會默認的去加載resource資源文件裏面的資源,其他地方的配置資源不會加載 。故沒有讀取到mybatis的MapperXml映射 結構如下 =======
SpringBoot出現Invalid bound statement (not found)以及application.yml出錯
看值後面是否有 kkon空格,哥就kaza卡在這 mapper-locations:空格clas mybatis: mapper-locations: classpath:mapper/*.xml &n
[MyBatis]詭異的Invalid bound statement (not found)錯誤
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
mybatis 報錯 Invalid bound statement (not found)
在使用springMVC 和 mybatis 整合時,報如下錯誤: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wechatlearning.permission
mybatis報錯:Invalid bound statement (not found):
Invalid bound statement (not found): 找不到執行的函式; 轉載: https://www.cnblogs.com/liaojie970/p/8034525.html Invalid bound statement (not found)錯誤的可能原因:
mybatis錯誤:Invalid bound statement (not found)
今天嚮往常一樣搭建一個spring-mybatis專案時,由於一開始dao 的路徑寫錯了,於是手動修改路徑,直接建立了一個叫com.XX.XX.XX的路徑。啟動專案的時候,總是報錯。Exception in thread "main" java.lang.RuntimeExc
關於IDEA工具在springboot整合mybatis中出現的Invalid bound statement (not found)問題
第一次寫部落格。有點小激動。 筆者因為工作需要,所以需要學習springboot和springcloud,而開發工具則是公司要求使用的IDEA2017,筆者之前的開發工具是Myeclipse. 換了工具有諸多的不適應,還在慢慢的熟悉 在學習過程中難免有些磕磕碰碰,幾天下來碰
解決IDEA中springboot整合mybatis中出現的Invalid bound statement(not found)的問題
IDEA對xml檔案處理的方式不同,在Eclipse中到dao檔案與mapper.xml檔案只要在同一級目錄下即可,但是在IDEA中,mapper.xml要放在resources目錄下 所以針對myba
IDEA中Mybatis傳統配置映射文件的時候遇到org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): mapper.UserMapper.getUserById錯誤時
apache image 傳統 .com ima app .get 映射 bin 我不知道是IDEA機制的問題還是咋回事 不會自動加載到這個文件裏來 沒搞太明白 IDEA中Mybatis傳統配置映射文件的時候遇到org.apache.ibatis.bind
Springboot中mybatis報錯:Invalid bound statement (not found)
小場面不要驚慌,分5種情況,檢查你的配置和程式碼,看有沒有中招; xml檔案的select標籤的id對應dao檔案的方法名,兩者必須完全一致 xml檔案中的 namespace=“xxx.xxx.xxx.Mapper” 中的路徑是否與介面檔案路徑一致 xml檔案中的p
關於在整合mybatis、spring、springmvc時出現的Invalid bound statement (not found): 錯誤
今天在使用ssm框架進行ajax使用測試的時候,copy了教學視訊的程式碼,程式結構如下: sping的關於mybatis的配置語句如下: <!-- mapper的加強————————1.配置SqlSessionFactory --> <bean class="org
SpringBoot整合mybatis報錯org.apache.ibatis.binding.BindingException: Invalid bound statement not found異常
問題記錄 問題是:找不到你專案對映檔案(*.xml) 在application.properties檔案中新增 mybatis.mapper-locations=classpath*:/mapper/**Mapper.xml 如果屬性檔案是.yml的,新增 mybati
springboot整合MyBatis:Invalid bound statement (not found)
報錯現象說明:1、為什麼報Invalid bound statement (not found): com.join.stump.site.service.MenuService.queryMenuList2、為什麼service的物件型別是org.apache.ibatis
新版IntelliJ IDEA中Mybatis報Invalid bound statement (not found)錯誤解決辦法
由於新版的IntelliJ IDEA不再編譯source folder下的xml檔案,而我們平時使用mybatis時,習慣於將*Mapper.xml檔案放在與dao層、service層平級的src目錄下。這就導致ItelliJ IDEA不會變異這些xml資料夾,從而導致In
SpringBoot整合mybatis報錯:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
無法綁定 boot strong https tails tis 查看 csdn sta 在使用SpringBoot整合mybatis時一直報錯:org.apache.ibatis.binding.BindingException: Invalid bound statem
spring boot 整合mybatis:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
pri ssp path 內容 方案 sta 問題 xmapp not 最近在學習SpringBoot,遇到些異常情況: 1、異常信息 org.apache.ibatis.binding.BindingException: Invalid bound statement (
解決mybatis中的org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
解決mybatis中的org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)問題: 1、檢查mapper.xml與mapper.java的namespace中的名字是否相符合; 2、檢
IDEA中配置mybstis顯示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
初次使用IDEA配置mybatis發現報錯 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 網上找了很多解決方法都沒效,確認了mapper的配置是沒有問題的 然後無意中發現
springboot 中 Invalid bound statement (not found):錯誤
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zpjeck.mapper.EmployeeMapper.insertEmp at org.apache.