在使用mybatis的过程中,当出现找不到参数值的情况的时候,问题主要是因为配置文件中的namespace 不正确导致的,namespace的值应该设置为接口mapper,详细参考下面的配置信息;
Exception in thread "main" java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:593)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:393)
at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:160)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:37)
[color=red]<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations">
<list>
<value>classpath*:com/spring/entity/*.xml</value>
</list>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.spring.mapper" />
<property name="markerInterface" value="com.spring.mapper.SqlMapper" />
</bean>[/color]
[b]<mapper namespace="com.spring.mapper.TPlatformTemplateMapper">
</mapper>[/b]
Exception in thread "main" java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:593)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:393)
at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:160)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:37)
[color=red]<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations">
<list>
<value>classpath*:com/spring/entity/*.xml</value>
</list>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.spring.mapper" />
<property name="markerInterface" value="com.spring.mapper.SqlMapper" />
</bean>[/color]
[b]<mapper namespace="com.spring.mapper.TPlatformTemplateMapper">
</mapper>[/b]