mybatis-config.xml代码
时间: 2024-01-17 20:03:29 浏览: 224
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>
<typeAliases>
<!-- 定义别名 -->
<typeAlias type="com.example.demo.entity.User" alias="User"/>
</typeAliases>
<mappers>
<!-- 加载mapper文件 -->
<mapper resource="mapper/UserMapper.xml"/>
</mappers>
<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/db_name"/>
<property name="username" value="username"/>
<property name="password" value="password"/>
</dataSource>
</environment>
</environments>
</configuration>
阅读全文