mybatis的配置

jdbc.properties

driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
url1=jdbc:mysql://localhost:3306/d?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
username=root
password=root


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>
      <properties resource="jdbc.properties">
     
      </properties>
      
      <typeAliases>
        <package name="com.xuewen.demo.mybatis.bean"/>
      </typeAliases>
     
           
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="${driver}" />
                <property name="url" value="${url1}"/>
                <property name="username" value="${username}" />
                <property name="password" value="${password}" />
            </dataSource>
        </environment>
    </environments>
         

         
    <mappers>
        <mapper resource="com/xuewen/demo/mybatis/mapper/StudentMapper.xml"/>
    </mappers>

</configuration>

你可能感兴趣的:(mybatis)