Mapped Statements collection does not contain value for mybatis mapper
<p>I am user mybatis and spring to create some test website. Right now I got a problem when trying to use mybatis xml mapper. Issue is something like "java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cooldrinker.mybatis.mapper.AdminMapper.getAdminByUsername"</p>

<p>servlet.xml</p>

<pre><code>&lt;bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource" /&gt;
        &lt;property name="typeAliasesPackage" value="com.cooldrinker.mybatis.model"/&gt;
        &lt;property name="mapperLocations" value="classpath*:com/cooldrinker/mybatis/mapper/*.xml" /&gt;
    &lt;/bean&gt;
</code></pre>

<p>Java mapper</p>

<pre><code>package com.cooldrinker.mybatis.mapper;

import com.cooldrinker.mybatis.model.Admin;

public interface AdminMapper {
    public Admin getAdminByUsername(String username);
}
</code></pre>

<p>xml mapper</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;

&lt;!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;

&lt;mapper namespace="com.cooldrinker.mybatis.mapper.AdminMapper"&gt;
    &lt;select id="getAdminByUsername" parameterType="java.lang.String" resultType="adminResultMap"&gt;
        SELECT first_name, last_name, password, username
        FROM admin
        WHERE username = #{username}
    &lt;/select&gt;

    &lt;resultMap id="adminResultMap" type="com.cooldrinker.mybatis.model.Admin"&gt;
        &lt;result property="firstName" column="first_name" /&gt;
        &lt;result property="username" column="last_name"/&gt;
        &lt;result property="password" column="password"/&gt;
        &lt;result property="username" column="username"/&gt;
    &lt;/resultMap&gt;
&lt;/mapper&gt;
</code></pre>

<p>stack trace</p>

<pre><code>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cooldrinker.mybatis.mapper.AdminMapper.getAdminByUsername
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cooldrinker.mybatis.mapper.AdminMapper.getAdminByUsername
    org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:672)
    org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:507)
    org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:500)
    org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:240)
    org.apache.ibatis.binding.MapperMethod.&lt;init&gt;(MapperMethod.java:71)
    org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:39)
    com.sun.proxy.$Proxy38.getAdminByUsername(Unknown Source)
    com.cooldrinker.mybatis.dao.impl.AdminDaoImpl.getAdminByUsername(AdminDaoImpl.java:24)
    com.cooldrinker.dataservice.service.impl.AdminServiceImpl.getAdminByUsername(AdminServiceImpl.java:26)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    com.sun.proxy.$Proxy42.getAdminByUsername(Unknown Source)
    com.cooldrinker.controller.AdminLoginController.login(AdminLoginController.java:39)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</code></pre>