configuration.xml里:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<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/testmybatis?useSSL=false"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper class="dao.StudentDao"/>
</mappers>
</configuration>
原来的
<mappers>
<mapper resource="studentMapper.xml"/>
</mappers>
基于注解的话,标签就改成了class
<mappers>
<mapper class="dao.StudentDao"/>
</mappers>
如果没改过来,会报错: