一、问题描述:
mybatis-config.xml配置:
Junit测试遇到报错,如下图:
二、解决方法:
注册mapper:
<configuration>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=false&userUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</dataSource>
</environment>
</environments>
<mappers>
<!--下面的resource路径是提示为注册的Mapper.xml路径-->
<mapper resource="com/suhuiteng/Dao/UserMapper.xml" />
</mappers>
</configuration>