天天看點

Mybatis

MyBatis

1.什麼是MyBatis

是一款優秀的持久層架構

資料持久化:

  • 持久化就是将程式的資料在持久狀态和瞬時狀态轉化的過程
  • 記憶體:斷電即失
  • 資料庫(Jdbc),io檔案持久化。

持久層:

Dao層、Service層、Controller層

  • 完成持久化工作的代碼塊
  • 層界限十分明顯

2.搭建環境

1.pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>MyBatis</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.19</version>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>
</project>
           
2.mybatis核心配置檔案

resources->mybatis核心配置檔案

<?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>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="com.mysql.cj.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost:3306/smbms?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT"/>
                <property name="username" value="root"/>
                <property name="password" value="123456"/>
            </dataSource>
        </environment>
    </environments>
    <mappers>
        <mapper resource="com/mapper/mapper.xml"/>
    </mappers>
</configuration>
           
3.pojo編寫實體類(略

需要連接配接資料庫

4.mybatis工具類
public class myBatisUtils {
    private static SqlSessionFactory sqlSessionFactory;
    static {
        try {
            sqlSessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("map.xml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static SqlSession getsqlSession(){
        return sqlSessionFactory.openSession();
    }
}
           
5.Mapper接口
public interface userMapper {
    public List<User> getUserList();

}
           
6.接口實作(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="com.mapper.userMapper">
    <select id="getUserList" resultType="com.pojo.User">
    select * from smbms_user
    </select>
</mapper>
           
7.Junit測試
import com.pojo.User;
import com.utils.myBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import com.mapper.userMapper;

public class mapperTest {
    @Test
    public void test(){
        SqlSession sqlSession = myBatisUtils.getsqlSession();
        userMapper mapper = sqlSession.getMapper(userMapper.class);
        for (User user : mapper.getUserList()) {
            System.out.println(user.getUserName());
        }
        sqlSession.close();
    }
}
           

3.增删改查實作

<?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="com.mapper.userMapper">
    <delete id="deleteById" parameterType="int">
        delete
        from smbms_user
        where id = #{id};
    </delete>
    <select id="getUserList" resultType="com.pojo.User">
    select * from smbms_user
    </select>
    <select id="selectById" resultType="com.pojo.User">
        select * from smbms_user where id = #{id}
    </select>
    <update id="updatePwdById" parameterType="com.pojo.User">
        update smbms_user set userPassword = #{userPassword} where id = #{id}
    </update>
</mapper>
           

3.1 Map傳參

java接口

public int updatePwdById(Map<String,Object> map);
           

mapper定義sql語句,傳參類型為map

<update id="updatePwdById" parameterType="map">
    update smbms_user set userPassword = #{pwd} where id = #{id}
</update>
           

測試類

@Test
public void test2(){
    SqlSession sqlSession = myBatisUtils.getsqlSession();
    userMapper mapper = sqlSession.getMapper(userMapper.class);
    Map<String,Object> integerStringHashMap = new HashMap<>();
    integerStringHashMap.put("id",6);
    integerStringHashMap.put("pwd","123456");
    mapper.updatePwdById(integerStringHashMap);
    sqlSession.commit();
    sqlSession.close();
}
           

優勢:在實體類屬性過多的情況下,選擇性追蹤主要參數并以map存儲,且可以多次傳參

4.解決屬性名與字段名不一緻的問題

<resultMap id="Map" type="User">
    <result column="userName" property="userCode"/>
</resultMap>
           
<select id="getUserListLike" resultMap="Map">
    select *
    from smbms_user where userName
    like #{value};
</select>
           
public void test4(){
    SqlSession sqlSession = myBatisUtils.getsqlSession();
    userMapper mapper = sqlSession.getMapper(userMapper.class);
    List<User> list = mapper.getUserListLike("李%");
    for (User user : list) {
        System.out.println(user);
    }
}
           

6.日志

如果一個資料庫操作出現異常,日志是最好的排錯助手,setting中導入

LOG4J STDOUT_LOGGING

SLF4J在springboot有用

STDOUT_LOGGING:

  • name :logImpl
  • value:STDOUT_LOGGING

    在mybatis核心配置檔案中配置日志。

<settings>
    <setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
           

LOG4J

  1. 了解:Log4j是Apache的一個開源項目,可以控制日志資訊輸送的目的地是控制台、檔案、GUI元件,可以控制每一條日志的輸出格式
  2. 操作:
    • 建立log4j.properties
    • 配置
      <setting name="logImpl" value="log4j"/>
                 
      log4j.rootLogger=DEBUG,console,file
      
      #控制台輸出的相關設定
      log4j.appender.console = org.apache.log4j.ConsoleAppender
      log4j.appender.console.Target = System.out
      log4j.appender.console.Threshold=DEBUG
      log4j.appender.console.layout = org.apache.log4j.PatternLayout
      log4j.appender.console.layout.ConversionPattern=[%c]-%m%n
      
      #檔案輸出的相關設定
      log4j.appender.file = org.apache.log4j.RollingFileAppender
      log4j.appender.file.File=./log/kuang.log
      log4j.appender.file.MaxFileSize=10mb
      log4j.appender.file.Threshold=DEBUG
      log4j.appender.file.layout=org.apache.log4j.PatternLayout
      log4j.appender.file.layout.ConversionPattern=[%p][%d{yy-MM-dd}][%c]%m%n
      
      #日志輸出級别
      log4j.logger.org.mybatis=DEBUG
      log4j.logger.java.sql=DEBUG
      log4j.logger.java.sql.Statement=DEBUG
      log4j.logger.java.sql.ResultSet=DEBUG
      log4j.logger.java.sql.PreparedStatement=DEBUG
                 
    • 配置log4j為日志的實作
    • 簡單使用
      1. 在Log4j的類中導入包import org.apache.log4j.Logger;
      2. 日志對象,參數為目前類的class
        @Test
        public void test(){
            Logger logger = Logger.getLogger(Log4jTest.class);
            logger.info("info:進入了log4j");
            logger.debug("debug:進入了log4j");
            logger.error("error:進入了log4j");
        }
                   
      3. 使用例子
        static Logger logger = Logger.getLogger(mapperTest.class);
        @Test
        public void test(){
            SqlSession sqlSession = myBatisUtils.getsqlSession();
            userMapper mapper = sqlSession.getMapper(userMapper.class);
            for (User user : mapper.getUserList()) {
                System.out.println(user.getUserName());
                logger.info("測試點");
            }
            sqlSession.close();
        }
                   
      4. 點開日志
        [DEBUG][21-12-02][org.apache.ibatis.transaction.jdbc.JdbcTransaction]Resetting autocommit to true on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@6cd28fa7]
        [DEBUG][21-12-02][org.apache.ibatis.transaction.jdbc.JdbcTransaction]Closing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@6cd28fa7]
        [DEBUG][21-12-02][org.apache.ibatis.datasource.pooled.PooledDataSource]Returned connection 1825738663 to pool.
        [DEBUG][21-12-02][org.apache.ibatis.logging.LogFactory]Logging initialized using 'class org.apache.ibatis.logging.log4j.Log4jImpl' adapter.
        [DEBUG][21-12-02][org.apache.ibatis.logging.LogFactory]Logging initialized using 'class org.apache.ibatis.logging.log4j.Log4jImpl' adapter.
        [DEBUG][21-12-02][org.apache.ibatis.io.VFS]Class not found: org.jboss.vfs.VFS
        [DEBUG][21-12-02][org.apache.ibatis.io.JBoss6VFS]JBoss 6 VFS API is not available in this environment.
        [DEBUG][21-12-02][org.apache.ibatis.io.VFS]Class not found: org.jboss.vfs.VirtualFile
        [DEBUG][21-12-02][org.apache.ibatis.io.VFS]VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
        [DEBUG][21-12-02][org.apache.ibatis.io.VFS]Using VFS adapter org.apache.ibatis.io.DefaultVFS
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Find JAR URL: file:/C:/Users/29522/Desktop/%e5%ad%a6%e4%b9%a0%e8%b5%84%e6%96%992.0/MyBatis/target/classes/com/pojo
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Not a JAR: file:/C:/Users/29522/Desktop/%e5%ad%a6%e4%b9%a0%e8%b5%84%e6%96%992.0/MyBatis/target/classes/com/pojo
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Reader entry: User.class
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Listing file:/C:/Users/29522/Desktop/%e5%ad%a6%e4%b9%a0%e8%b5%84%e6%96%992.0/MyBatis/target/classes/com/pojo
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Find JAR URL: file:/C:/Users/29522/Desktop/%e5%ad%a6%e4%b9%a0%e8%b5%84%e6%96%992.0/MyBatis/target/classes/com/pojo/User.class
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Not a JAR: file:/C:/Users/29522/Desktop/%e5%ad%a6%e4%b9%a0%e8%b5%84%e6%96%992.0/MyBatis/target/classes/com/pojo/User.class
        [DEBUG][21-12-02][org.apache.ibatis.io.DefaultVFS]Reader entry: ����
                   

7.分頁

減少資料的處理量

Limit分頁

select * from table limit 0,2;
           

解釋:從第1個開始往後查2位

select * from table limit 2;
           

解釋:從第1個開始往後查到第3位

7.1使用Mybatis實作分頁
  1. 接口
    //    分頁查詢
        public List<User> getUserByLimit(Map<String,Integer> map);
               
  2. mapper.xml
    <select id="getUserByLimit" parameterType="map" resultType="User">
        select * from smbms_user limit #{startIndex},#{pageSize}
    </select>
               
  3. 測試
@Test
public void test5(){
    SqlSession sqlSession = myBatisUtils.getsqlSession();
    userMapper mapper = sqlSession.getMapper(userMapper.class);
    HashMap<String, Integer> map = new HashMap<>();
    map.put("startIndex",0);
    map.put("pageSize",2);
    List<User> userByLimit = mapper.getUserByLimit(map);
    for (User user : userByLimit) {
        System.out.println(user);
    }
    sqlSession.close();
}
           
7.2RowBounds分頁

我不會

7.3分頁插件

PageHelper:

MyBatis 分頁插件 PageHelper

8.注解開發

面向接口程式設計,解耦

(注解一時爽,維護火葬場)

注解的增删改查CRUD

  1. 配置mapper,将接口注冊綁定到核心配置檔案
    <mapper class="com.mapper.userMapper"/>
               
  2. 設定環境配置,自動送出事務
    public static SqlSession getsqlSession(){
        return sqlSessionFactory.openSession(true);
    }
               
  3. 注解帶參
    @Update("update smbms.smbms_user set userPassword = #{pwd} where id = #{id}")
    public int updatePwdByIdInn(@Param("pwd")String pwd,@Param("id") int id);
               
    其實@Param("key")
    • 基本類型的參數或者String類型,需要補充@Param的參數
    • 引用類型不需要加
    • 如果隻有一個基本類型,可以忽略
Lombok

從maven中導包,通過注解可以自動封裝實體類,但不推薦使用

  • @Data
  • @AllArgsConstructor(構造滿參函數)
  • @NoArgsConstructor(構造無參函數)
  • @toString
  • @Getter & Setter

9.多對一處理

學生對老師

1.測試環境搭建
  1. 實體類Teacher,Student
  2. 建立Mapper接口
  3. 建立Mapper.xml
  4. 核心配置檔案中綁定注冊Mapper接口或檔案
  5. 測試,成功進入下一步
2.按照查詢嵌套處理
<mapper namespace="com.mapper.StudentMapper">

    <select id="getStudent" resultMap="StudentTeacher">
        select * from student
    </select>
    <resultMap id="StudentTeacher" type="com.pojo.Student">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <association property="teacher" column="tid" javaType="com.pojo.Teacher" select="getTeacher"/>
    </resultMap>
    <select id="getTeacher" resultType="com.pojo.Teacher">
        select * from teacher where id = #{id}
    </select>
</mapper>
           
3.按照結果嵌套查詢
<mapper namespace="com.mapper.StudentMapper">
    <select id="getStudent" resultMap="StudentTeacher">
        select s.id sid,s.name sname,t.name tname
        from student s,teacher t
        where s.tid = t.id
    </select>
    <resultMap id="StudentTeacher" type="com.pojo.Student">
        <result property="id" column="sid"/>
        <result property="name" column="sname"/>
        <association property="teacher" javaType="com.pojo.Teacher">
            <result property="name" column="tname"/>
        </association>
    </resultMap>
</mapper>
           

mysql多對一查詢方式

  • 子查詢
  • 聯表查詢

10.一對多處理

老師對學生

1.按結果嵌套查詢(推薦使用,原生sql)
public interface teacherMapper {
    public List<Teacher> getTeacher();
    public List<Teacher> getTeacherById(@Param("tid")int id);
}
           
<mapper namespace="com.mapper.teacherMapper">

    <select id="getTeacher" resultType="com.pojo.Teacher">
        select * from teacher
    </select>
    <select id="getTeacherById" resultMap="TeacherStudent">
        select s.id sid,s.name sname,t.name tname,t.id tid from student s,teacher t
        where s.tid = t.id and t.id = 1;
    </select>
    <resultMap id="TeacherStudent" type="com.pojo.Teacher">
        <result property="name" column="tname"/>
        <result property="id" column="tid"/>
        <collection property="getStudents" ofType="com.pojo.Student">
            <result property="id" column="sid"/>
            <result property="name" column="sname"/>
            <result property="tid" column="tid"/>
        </collection>
    </resultMap>
</mapper>
           
2.按子查詢方式查詢

想查詢老師再查詢學生

<mapper namespace="com.mapper.teacherMapper">

<!--    需要差別的是
        ofType 針對于實體對象
        javaType 對應集合對象-->
<!--    private List<Student> getStudents;-->

    <select id="getStudentByTid" resultMap="TeacherStudent2">
        select * from teacher where id = #{tid}
    </select>
    <resultMap id="TeacherStudent2" type="com.pojo.Teacher">
        <collection property="getStudents" javaType="ArrayList" ofType="com.pojo.Student" select="getStudentByTeacherId" column="id"/>
    </resultMap>
    <select id="getStudentByTeacherId" resultType="com.pojo.Student">
        select * from student where tid = #{tid}
    </select>
    
</mapper>
           
3.總結
  • 關聯association 多對一
  • 集合collection 一對多
  • javaType指定實體類中的屬性類型
  • ofType指定映射到List或集合中的pojo類型,泛型中的限制類型

11.動态sql

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mapper.blogMapper">
    <insert id="addBlok" parameterType="com.pojo.Blog" >
        insert into blog (id,title,author,create_time,views)
        values (#{id},#{title},#{author},#{createTime},#{views});
    </insert>
    <select id="quaryBlogIF" parameterType="map" resultType="com.pojo.Blog">
        select * from blog
        where 1=1
        <if test="title != null">
            and title = #{title}
        </if>
        <if test="author != null">
            and author = #{author}
        </if>
    </select>
</mapper>
           
public interface blogMapper {
//    插入資料
    int addBlok(Blog blog);
//    查詢部落格
    List<Blog> quaryBlogIF(Map map);
}
           
@Test
public void testBlog(){
    SqlSession sqlSession = myBatisUtil.getSqlSession();
    blogMapper mapper = sqlSession.getMapper(blogMapper.class);
    Blog blog = new Blog();
    blog.setId(IDutils.getID());
    blog.setAuthor("盧本偉");
    blog.setTitle("牛逼");
    blog.setCreateTime(new Date());
    blog.setViews(3);
    mapper.addBlok(blog);
    sqlSession.close();
}
@Test
public void testBlogIF(){
    SqlSession sqlSession = myBatisUtil.getSqlSession();
    blogMapper mapper = sqlSession.getMapper(blogMapper.class);
    HashMap hashMap = new HashMap();
    hashMap.put("title","牛逼");
    for (Blog blog : mapper.quaryBlogIF(hashMap)) {
        System.out.println(blog);
    }
    sqlSession.close();
}
           
1.if

将上述執行個體

2.choose(when,otherwise)
3.trim(where,set)
4.sql片段(sql,include)

建議包含if片段

5.foreach

通用初始化

resources 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="pd.properties"/>
    <settings>
        <setting name="logImpl" value="log4j"/>
        <setting name="mapUnderscoreToCamelCase" value="true"/>
    </settings>
    <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 resource="Mapper路徑"/>
    </mappers>
</configuration>
           

sqlbase.properties

driver = com.mysql.cj.jdbc.Driver
url = jdbc:mysql://localhost:3306/smbms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT
username = root
password = 123456
           

log4j.properties

log4j.rootLogger=DEBUG,console,file

#??????????
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.out
log4j.appender.console.Threshold=DEBUG
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%c]-%m%n

#?????????
log4j.appender.file = org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./log/kuang.log
log4j.appender.file.MaxFileSize=10mb
log4j.appender.file.Threshold=DEBUG
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%p][%d{yy-MM-dd}][%c]%m%n

#??????
log4j.logger.org.mybatis=DEBUG
log4j.logger.java.sql=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
           

mapper鏡像.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="接口路徑">
</mapper>
           

mapper接口.java

pojo/實體類

Utils

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;  
private static SqlSessionFactory sqlSessionFactory;
  static {
      String src = "map.xml";
      InputStream resourceAsStream = null;
      try {
          resourceAsStream = Resources.getResourceAsStream(src);
      } catch (IOException e) {
          e.printStackTrace();
      }
      sqlSessionFactory  = new SqlSessionFactoryBuilder().build(resourceAsStream);
  }
  public static SqlSession getSqlSession(){
      return sqlSessionFactory.openSession(true);
  }
           

pom.xml

<dependencies>
        <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.10.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.10.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.13</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.3.13</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.19</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.3</version>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.8.2</version>
        </dependency>

    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/resources/map</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>