mybatis报错
1.先看看
严重: Servlet.service() for servlet [springDispatcherServlet] in context with path [/SocketSSM] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.mapper.UserMapper.usernameGetUser] with root cause
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.mapper.UserMapper.usernameGetUser
1.先看看
<mapper namespace="com.mapper.UserMapper">
namespace要写对
2.在看xml
<select id="getPassword" parameterType="String" resultType="String">
id要与相关mapper中方法名一致
3.如果都没错就要看有没有引入xml了
<!-- 扫描存放SQL语句的Category.xml -->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="typeAliasesPackage" value="pojo" />
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="classpath:com/mapper/*.xml"/>
</bean>