java.lang.IllegalArgumentException: Mapped Statements collection does not contai

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.XX.dao.UserMapper.getUserList
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176)
	... 50 more

 

 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.XX.dao.UserMapper.getUserList
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)

 最近在用mybatis出现上次错误,原因:

<!-- define the SqlSessionFactory -->
	<bean id="sqlSessionFactory"
		class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<!--<property name="configLocation" value="classpath:mybatis-conf.xml" />-->
		<property name="typeAliasesPackage" value="com.XX" />
	</bean>

sqlSessionFactory上并未注册或获取到*mapper.xml里面的sql语句信息,造成这个原因无非就是:

*mapper.xml未找到或里面的sql中跟mapper接口中的方法不对应。

总之,从sqlSessionFactory或xml中入手,很容易揪出错的,而且配置这块经常容易出问题,尤其对mybatis不熟或首次集成的time!

你可能感兴趣的:(Collection)