0.总配置文件mybatis-config.xml
位置
resources目录下
mybatis-config.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"/>
<!--配置数据源:创建Connection对象-->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/bjpowernode?useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="admin"/>
</dataSource>
</environment>
</environments>
<!--指定其他mapper文件的位置
找到其他mapper文件的目的是找到sql语句
使用注意:
resource="mapper.文件的路径,用/分割"-->
<mappers>
<mapper resource="Dao/StudentMapper.xml"/>
</mappers>
</configuration>