Mybatis - 导入的包以及文件头

Mybatis 要导入的包

<properties>
    <mybatis.version>3.5.2</mybatis.version>
    <mysql.version>8.0.20</mysql.version>
  </properties>

  <dependencies>
    <!--mybatis start-->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>${mybatis.version}</version>
    </dependency>
    <!--mybatis end-->

    <!--mysql driver start-->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${mysql.version}</version>
    </dependency>
    <!--mysql driver end-->
  </dependencies>

  <!--资源文件编译到classes-->
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.xml</include>
        </includes>
        <filtering>true<filtering/>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <filtering>true<filtering/>
      </resource>
    </resources>
  </build>

文件头 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>

</configuration>

文件头 mapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<!--绑定一个对应的接口-->
<mapper namespace="">

</mapper>

 

posted on 2021-12-07 17:27  每天积极向上  阅读(172)  评论(0编辑  收藏  举报

导航