今天重新一下mybatis的基础,然后一直报错,提示的是 result map 找不到com.zm.model.User对象
可是看 mapper的写法没问题.
找了半天才发现 是mapper没扫描到
解决
直接在pom中就下面的就行,表示将src/main/java中的xml和properties文件复制到classes下
<build>
<finalName>MybatisDemo</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>