• 整合mybatis


    1、回顾mybatis 

     官方文档:http://mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/

     

    Maven仓库地址:https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter/2.1.1

     

    步骤:

    (1)导入jar包

    junit 

    1. <dependencies>
    2. <dependency>
    3. <groupId>junitgroupId>
    4. <artifactId>junitartifactId>
    5. <version>4.12version>
    6. dependency>

    mybatis

    1. <dependency>
    2. <groupId>org.mybatisgroupId>
    3. <artifactId>mybatisartifactId>
    4. <version>3.5.2version>
    5. dependency>

     

    记得要对应版本!

    mysql数据库

    1. <dependency>
    2. <groupId>mysqlgroupId>
    3. <artifactId>mysql-connector-javaartifactId>
    4. <version>5.1.47version>
    5. dependency>

     

    spring相关

    1. <dependency>
    2. <groupId>org.springframeworkgroupId>
    3. <artifactId>spring-webmvcartifactId>
    4. <version>5.1.9.RELEASEversion>
    5. dependency>
    6. <dependency>
    7. <groupId>org.springframeworkgroupId>
    8. <artifactId>spring-jdbcartifactId>
    9. <version>5.1.9.RELEASEversion>
    10. dependency>

    aop织入

    1. <dependency>
    2. <groupId>org.aspectjgroupId>
    3. <artifactId>aspectjweaverartifactId>
    4. <version>1.8.13version>
    5. dependency>

     

    mybatis-spring【new】

    1. <dependency>
    2. <groupId>org.mybatisgroupId>
    3. <artifactId>mybatis-springartifactId>
    4. <version>2.0.2version>
    5. dependency>
    6. <dependency>
    7. <groupId>org.projectlombokgroupId>
    8. <artifactId>lombokartifactId>
    9. <version>1.16.10version>
    10. dependency>
    11. <dependency>
    12. <groupId>org.springframeworkgroupId>
    13. <artifactId>spring-jdbcartifactId>
    14. <version>5.3.19version>
    15. <scope>compilescope>
    16. dependency>

     

    扩展:

    1、如果出现UTF-8乱码问题:

    • [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
    • [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!

    则需要在pom中配置

    1. <properties>
    2. <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
    3. properties>

  • 相关阅读:
    Nginx基础篇-Nginx的WEB模块~连接状态
    Redis 中的过期删除策略和内存淘汰机制
    nginx可以转发telegraf发送给kafka的数据吗?
    使用C# RDLC环境搭建
    猿创征文|在CSDN学习的那些事
    MATLAB:电机控制(Motor Control)
    【数据结构】栈和队列的实现
    欧拉函数——可见的点
    牛客网刷题训练(一)
    LeetCode //C - 117. Populating Next Right Pointers in Each Node II
  • 原文地址:https://blog.csdn.net/qq_46423017/article/details/126687064