报错ERROR 10752 — [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mapper.UserMapper.login] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mapper.UserMapper.login
这个问题,代表你的xml配置文件没有被加载。通常这种情况出现在你的mapper,mapper.xml是在同一个包下,如下图:
解决方式:
在pom文件中添加:
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
指定了资源文件的目录为src/main/java。这里特别指定了src/main/java目录,意味着Maven在构建过程中会将src/main/java下的.xml文件视为资源文件处理。当然了,最好是把xml文件放在resources下,方便管理,还少麻烦