解決: ...
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@41cf53f9: startup date
[Wed Apr 05 16:48:12 CST 2017]; root of context hierarchy 四月 05, 2017 4:48:12 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from class path resource [com/ij34/mybatis/applicationContext.xml] Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:230) 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.$Proxy4.selectUser(Unknown Source) at com.ij34.bean.Test.main(Test.java:24)
解決:
- 檢查xml文件所在的package名稱是否和interface對應的package名稱一一對應
- 檢查xml文件的namespace是否和xml文件的package名稱一一對應
- 檢查函數名稱能否對應上
- 去掉xml文件中的中文註釋
- 隨意在xml文件中加一個空格或者空行然後保存