Mybatis配置

Mybatis配置,第1张

流文件 Mybatis配置文件db.properties
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mybatis?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username=root
password=135246
Mybatis.xml文件

DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">


<configuration>


    <properties resource="db.properties">
        <property name="username" value="root"/>
        <property name="password" value="135246"/>
    properties>








    <typeAliases>
        <package name="com.gmy.pojo"/>
    typeAliases>

    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="${driver}"/>
                <property name="url" value="${url}"/>
                <property name="username" value="${username}"/>
                <property name="password" value="${password}"/>
            dataSource>
        environment>
    environments>







    <mappers>
        <mapper class="com.gmy.dao.BlogMapper" >mapper>
    mappers>
configuration>
实现接口的配置文件 dao.xml

DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">


<mapper namespace="com.gmy.dao.BlogMapper">

mapper>

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/869900.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-13
下一篇 2022-05-13

发表评论

登录后才能评论

评论列表(0条)

保存