Mybatis:Mybatis配置文件模板

1、引入依赖

 <dependency>
            <groupId>org.mybatisgroupId>
            <artifactId>mybatisartifactId>
            <version>3.4.6version>
        dependency>

2、配置文件模板



    <configuration>
    	
      configuration>

3、以mysql为数据源举例



    <configuration>
    
    <settings>
        <setting name="logImpl" value="STDOUT_LOGGING"/>
    settings>
    
    <typeAliases>
        
        <package name="com.ydx.entity"/>
    typeAliases>
    
          
    <plugins>
        <plugin interceptor="com.github.pagehelper.PageInterceptor"/>
    plugins>
    
        <environments default="mydb">
            <environment id="mydb">
                <transactionManager type="JDBC"/>
                <dataSource type="POOLED">
                      
                    <property name="driver" value="com.mysql.jdbc.Driver"/>
                    <property name="url" value="jdbc:mysql://localhost:3306/db3"/>
                    <property name="username" value="root"/>
                    <property name="password" value="123456"/>
                dataSource>
            environment>
        environments>
    
        <mappers>
            <mapper resource="DaoMapper/UserDaoMapper.xml"/>
        mappers>

    configuration>

你可能感兴趣的:(Mybatis,mybatis,mysql,jdbc,maven)