<?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核心配置文件--> <configuration> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="POOLED"> <!--导入DJBC驱动--> <property name="driver" value="com.mysql.jdbc.Driver"/> <!--连接数据库URL--> <property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=true&useUnicode=true&characterEncoding=UTF-8"/> <!--配置用户名--> <property name="username" value="root"/> <!--配置密码--> <property name="password" value="root"/> </dataSource> </environment> </environments>
<!--每一个mybatis的xml都需要在核心配置文件中进行注册--> </configuration>
文件名为mybatis-config.xml