liukaida 发表于 2016-11-24 05:24:56

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>
页: [1]
查看完整版本: mybatis的配置