Mybatis框架详解(全)

news2025/7/19 6:33:58

目录

MyBatis简介

MyBatis整体架构及运行流程

1.数据源配置文件

2.Sql映射文件

3.会话工厂与会话

4.运行流程

mybatis实现增删改查

Mybatis的获取参数的方式

mapper中自定义映射

mybatis注解开发

mybatis缓存

mybatis分页插件


MyBatis简介

MyBatis 是一款优秀的持久层框架,它支持自定义 SQL、存储过程以及高级映射。MyBatis 免除了几乎所有的 JDBC 代码以及设置参数和获取结果集的工作。MyBatis 可以通过简单的 XML 或注解来配置和映射原始类型、接口和 Java POJO(Plain Old Java Objects,普通老式 Java 对象)为数据库中的记录

2010年这个项目由apache software foundation 迁移到了google code,并且改名为MyBatis 。2013年11月迁移到Github。

回顾JDBC的使用步骤:

  • 1.加载驱动

Class.forName("com.mysql.jdbc.Driver");
  • 2.获取连接对象

DiverManerger.getConnection(url,username,password)
  • 3.获取执行sql的Statement对象

connection.CreateStatement();
  • 4.执行sql语句

  • 5.处理结果集

  • 6.释放连接

connection.Close()

与JDBC相比:

  1. Mybatis通过参数映射方式,可以将参数灵活的配置在SQL语句中的配置文件中,避免在Java类中配置参数

  2. Mybatis通过输出映射机制,将结果集的检索自动映射成相应的Java对象,避免对结果集手工检索

  3. Mybatis可以通过Xml配置文件对数据库连接进行管理

MyBatis整体架构及运行流程

Mybatis整体构造由 数据源配置文件、Sql映射文件、会话工厂、会话、执行器和底层封装对象组成

1.数据源配置文件

通过配置的方式将数据库的配置信息从应用程序中独立出来,由独立的模块管理和配置。Mybatis的数据源配置文件包含数据库驱动、数据库连接地址、用户名密码、事务管理等,还可以配置连接池的连接数、空闲时间等

一个MapConfig.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>
  <environments default="development">
    <environment id="development">
   <!-- 事务的管理 JDBC  MANAGED-->
      <transactionManager type="JDBC"/>
   <!-- 数据源 POOLED UNPOOLED JNDI -->
      <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="org/mybatis/example/BlogMapper.xml"/>
  </mappers>
</configuration>

mybatis mapper文件映射

 

 设置资源文件路径

Maven中默认是只会打包resource下的资源文件。如果我们的文件不放在resource, 则需要通过配置告知Maven

2.Sql映射文件

Mybatis中所有数据库的操作都会基于该映射文件和配置的sql语句,在这个配置文件中可以配置任何类型的sql语句。框架会根据配置文件中的参数配置,完成对sql语句以及输入输出参数的映射配置。

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="命名空间">

<select id="方法名" resultMap="返回值类型" parameterType="参数类型">

-- sql语句

</select>

</mapper>

 

3.会话工厂与会话

Mybatis中会话工厂SqlSessionFactory类可以通过加载资源文件,读取数据源配置MapConfig.xml信息,从而产生一种可以与数据库交互的会话实例SqlSession,会话实例SqlSession根据Mapper.xml文件中配置的sql,对数据库进行操作。

4.运行流程

会话工厂SqlSessionFactory通过加载资源文件获取MapConfig.xml配置文件信息,然后生成可以与数据库交互的会话实例SqlSession。会话实例可以根据Mapper配置文件中的Sql配置去执行相应的增删改查操作

执行流程图:

mybatis实现增删改查

public class TestStudent {

    @Test
    public void test01(){

        try {//加载配置文件
            InputStream in = Resources.getResourceAsStream("config/mybatis-config.xml");
            //获取sqlSession对象
            SqlSession sqlSession = new SqlSessionFactoryBuilder().build(in).openSession();
            //查询所有学生信息
        List<Student> students = sqlSession.selectList("cn.kgc.mybatis.dao.StudentDao.getAll");	
            students.forEach(student -> System.out.println(student) );
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void test02(){//查询一个学生信息

        try {//加载配置文件
            InputStream in = Resources.getResourceAsStream("config/mybatis-config.xml");
            //获取sqlSession对象
            SqlSession sqlSession = new SqlSessionFactoryBuilder().build(in).openSession();
            //根据用户名查询一个学生信息
            Student student = sqlSession.selectOne("cn.kgc.mybatis.dao.StudentDao.findOne","tom");
            System.out.println(student);
            sqlSession.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void test03() {//添加一个学生信息

        try {//加载配置文件
            InputStream in = Resources.getResourceAsStream("config/mybatis-config.xml");
            //获取sqlSession对象
            SqlSession sqlSession = new SqlSessionFactoryBuilder().build(in).openSession();
            //添加一个学生信息
            Student student = Student.builder().stuBirth(new Date()).stuName("lilei").stuNo("2021073001").stuSex("男").build();
            int i = sqlSession.insert("cn.kgc.mybatis.dao.StudentDao.addOne", student);
            System.out.println(i);
            sqlSession.commit();
            sqlSession.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
    @Test
    public void test04() {//删除一个学生信息

        try{
            InputStream in = Resources.getResourceAsStream("config/mybatis-config.xml");
            //获取sqlSession对象 同时可设置事务的自动提交  openSession(true)
            SqlSession sqlSession = new SqlSessionFactoryBuilder().build(in).openSession();
            int delete = sqlSession.delete("cn.kgc.mybatis.dao.StudentDao.delOne","lilei" );
            sqlSession.commit();
            sqlSession.close();
            System.out.println(delete);
        }catch (Exception e){
            e.printStackTrace();
        }

    }

    @Test
    public void test05() {//修改一个学生信息

        try{
            InputStream in = Resources.getResourceAsStream("config/mybatis-config.xml");
            //获取sqlSession对象
            SqlSession sqlSession = new SqlSessionFactoryBuilder().build(in).openSession();

            Student student = Student.builder().stuBirth(new Date()).stuName("lili").stuNo("2021073001").stuSex("女").build();
            int delete = sqlSession.update("cn.kgc.mybatis.dao.StudentDao.updateStudent",student);
            sqlSession.commit();
            sqlSession.close();
            System.out.println(delete);
        }catch (Exception e){
            e.printStackTrace();
        }


    }

}

 

mybatis中使用log4j日志工具

1.配置mybatis-config.xml

开启驼峰命名  

设置别名

 

2.配置log4j.properties文件,放置在resources目录下

log4j.rootLogger=DEBUG,Console

#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Target=System.out
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n

log4j.logger.org.apache=ERROR
log4j.logger.org.mybatis=ERROR
log4j.logger.org.springframework=ERROR

#这个需要
log4j.logger.log4jdbc.debug=ERROR
log4j.logger.com.gk.mapper=ERROR
log4j.logger.jdbc.audit=ERROR
log4j.logger.jdbc.resultset=ERROR
#这个打印SQL语句非常重要
log4j.logger.jdbc.sqlonly=DEBUG
log4j.logger.jdbc.sqltiming=ERROR
log4j.logger.jdbc.connection=FATAL

 

 使用mapper代理对象实现增删改查

public class TestStudentMapper {
    SqlSessionFactory factory;
    @Before
    public void init(){
        try {
            InputStream  in = Resources.getResourceAsStream("config/mybatis-config.xml");
            SqlSessionFactoryBuilder sfb = new SqlSessionFactoryBuilder();
            factory = sfb.build(in);
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
    @Test
    public void test01(){
            //开启事务自动提交
            SqlSession sqlSession = factory.openSession(true);
            //获取dao层的代理对象
            StudentDao studentDao = sqlSession.getMapper(StudentDao.class);
            List<Student> students = studentDao.getAll();
            students.forEach(student -> System.out.println(student));
    }

    @Test
    public void test02(){ //添加数据

        SqlSession sqlSession = factory.openSession(true);
        Student student = Student.builder().stuSex("男").stuNo("2021073100").stuName("李四").stuBirth(new Date()).build();
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);
        Integer line = studentDao.addOne(student);
        System.out.println(line);
    }

    @Test
    public  void test03(){//删除一条数据
        SqlSession sqlSession = factory.openSession(true);
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);
        Integer line = studentDao.delOne("李四");
        System.out.println(line);
    }

    @Test
    public void test04() { //修改数据
        SqlSession sqlSession = factory.openSession(true);
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);
        Student student = Student.builder().stuSex("女").stuNo("2021073100").stuName("李四").stuBirth(new Date()).build();
        Integer line = studentDao.updateOne(student);
        System.out.println(line);

    }
    
    @Test
    public void test06(){//模糊查询一个学生信息 一个参数
        SqlSession sqlSession = factory.openSession(true);
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);

        List<Student> students = studentDao.selectLikeName("li");
        System.out.println(students.toString());

    }

    @Test
    public void test07(){//模糊查询一个学生信息 两个参数
        SqlSession sqlSession = factory.openSession(true);
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);

        List<Student> students = studentDao.selectLikeName2("li", "2021072902");
        System.out.println(students.toString());


    }
     @Test
    public void test08(){//模糊查询一个学生信息 一个集合参数  mapper文件中按照key取值
        SqlSession sqlSession = factory.openSession(true);
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);

        HashMap<String, String> map = new HashMap<>();
        map.put("stuname","li");
        map.put("stuno", "2021072902");
        List<Student> students = studentDao.selectLikeName3(map);
        System.out.println(students.toString());
    }

}

 

Mybatis的获取参数的方式

方式1:${} 字符串拼接

方式2:#{} 占位符

1.Mapper接口参数为单个参数

2.Mapper接口参数是多个参数的获取

mybatis在处理多个参数时,会将多个参数保存到map集合中会 以 agr0 ,agr1或param1 param2为键 以参数位置进行存储

 

3.将参数设为map集合进行数据的传递

 

4.通过注解@param("键名")设置参数的获取名字

 

5.将多个参数设置成对象进行数据的传递

 

Mybatis中的模糊查询

 6.批量删除

mapper中自定义映射

自定义映射的用法之一,解决表格查询的字段名和实体类中不一致的情况

 

mybatis对象的关联关系

一对多关系处理(一方)

<resultMap id="selectByEIdMap" type="cn.kgc.mybatis.entity.Emp">
        <result column="id" property="dept.id" ></result>
        <result column="dname" property="dept.dName"></result>
 </resultMap>


    <resultMap id="selectByEIdMap2" type="cn.kgc.mybatis.entity.Emp">
        <id column="eid" property="eId"></id>
        <result column="ename" property="EName"></result>
        <result column="age" property="age"></result>
        <result column="deptno" property="deptNo"></result>
        <!--实体对象标识-->
       <association property="dept" javaType="dept">
           <id column="id" property="id"></id>
           <result column="dname" property="dName"></result>
       </association>
    </resultMap>

	<!-- 分步查询 -->
    <resultMap id="selectByEIdMap3" type="cn.kgc.mybatis.entity.Emp">
        <id column="eid" property="eId"></id>
        <result column="ename" property="EName"></result>
        <result column="age" property="age"></result>
        <result column="deptno" property="deptNo"></result>
        <association property="dept" select="cn.kgc.mybatis.mapper.DeptMapper.selectById" 
                                    column="deptno" 
                                    fetchType="eager">
        </association>
    </resultMap>

注:延迟加载设置  :
		1. <setting name="lazyLoadingEnabled" value="true"/> 
		2. <setting name="aggressiveLazyLoading" value="false"/>  3.4.1之前的版本需要设置

    <select id="selectByEId" resultMap="selectByEIdMap2">
            select  * from emp left  join  dept on  emp.deptno = dept.id  where eid = #{eid}
    </select>

    <select id="selectByEId2" resultMap="selectByEIdMap3">
            select  * from emp  where eid = #{eid}
    </select>

 

 一对多关系处理(多方)

 <resultMap id="BaseResultMap" type="cn.kgc.mybatis.entity.Dept">
            <id property="id" column="id" />
            <result property="dName" column="dname" />
            <collection property="emps" ofType="emp">
                <id column="eid" property="eId"></id>
                <result column="ename" property="EName"></result>
                <result column="age" property="age"></result>
                <result column="deptno" property="deptNo"></result>
            </collection>
    </resultMap>


    <resultMap id="BaseResultMap2" type="cn.kgc.mybatis.entity.Dept">
        <id property="id" column="id" />
        <result property="dName" column="dname" />
        <collection property="emps" select="cn.kgc.mybatis.mapper.EmpMapper.selectByDeptId" column="id"></collection>
    </resultMap>

    <select id="selectById" resultType="dept">
        select  * from dept where id = #{id}
    </select>

    <select id="selectById2" resultMap="BaseResultMap">
        select emp.* ,dept.* from dept left join emp on dept.id = emp.deptno where id = #{id}
    </select>

    <select id="selectById3" resultMap="BaseResultMap2">
        select dept.* from dept  where id = #{id}
    </select>

动态 SQL 是 MyBatis 的强大特性之一。如果你使用过 JDBC 或其它类似的框架,你应该能理解根据不同条件拼接 SQL 语句有多痛苦,例如拼接时要确保不能忘记添加必要的空格,还要注意去掉列表最后一个列名的逗号。利用动态 SQL,可以彻底摆脱这种痛苦

动态SQL:if 语句

根据 stu_name 和 stu_sex 来查询数据。如果stu_name为空,那么将只根据stu_sex来查询;反之只根据stu_name来查询

首先不使用 动态SQL 来书写

可以发现,如果 #{stu_name} 为空,那么查询结果也是空,如何解决这个问题呢?使用 if 来判断

 

 

这样写我们可以看到,如果 sex 等于 null,那么查询语句为 select * from student where stu_name=#{stu_name},但是如果stu_name 为空呢?那么查询语句为 select * from user where and stu_sex=#{sex},这是错误的 SQL 语句,如何解决呢?

if+where 语句

 

这个where标签会知道如果它包含的标签中有返回值的话,它就插入一个where。此外,如果标签返回的内容是以AND 或OR 开头的,则它会剔除掉

动态SQL:if+set 语句

上面的对于查询 SQL 语句包含 where 关键字,如果在进行更新操作的时候,含有 set 关键词

 

  • 如果第一个条件 username 为空,那么 sql 语句为:update user u set u.sex=? where id=?

  • 如果第一个条件不为空,那么 sql 语句为:update user u set u.username = ? ,u.sex = ? where id=?

动态SQL:choose(when,otherwise) 语句

有时候,我们不想用到所有的查询条件,只想选择其中的一个,查询条件有一个满足即可,使用 choose 标签可以解决此类问题,类似于 Java 的 switch 语句

 

这里我们有三个条件,id,username,sex,只能选择一个作为查询条件

  • 如果 id 不为空,那么查询语句为:select * from user where id=?

  • 如果 id 为空,那么看username 是否为空,如果不为空,那么语句为 select * from user where username=?;

  • 如果 username 为空,那么查询语句为 select * from user where sex=?

动态SQL:trim 语句

trim标记是一个格式化的标记,可以完成set或者是where标记的功能

用 trim 改写上面的 if+where 语句

  • prefix:前缀  

  • prefixoverride:去掉第一个and或者是or   

用 trim 改写上面的 if+set 语句

 

  • suffix:后缀  

  • suffixoverride:去掉最后一个逗号(也可以是其他的标记,就像是上面前缀中的and一样)

动态SQL: foreach 语句

需求:我们需要查询 user 表中 id 分别为1,2,3的用户,sql语句:

 

用 foreach 来改写 select * from user where id=1 or id=2 or id=3

 

 

用 foreach 来改写 select * from user where id in (1,2,3)

 

动态SQL: SQL 片段

有时候可能某个 sql 语句我们用的特别多,为了增加代码的重用性,简化代码,我们需要将这些代码抽取出来,然后使用时直接调用。

假如我们需要经常根据用户名和性别来进行联合查询,那么我们就把这个代码抽取出来,如下:

  

 

注意:①、最好基于 单表来定义 sql 片段,提高片段的可重用性

    ②、在 sql 片段中最好不要包括 where

mybatis注解开发

public interface StudentDao2 {

    @Select("select * from student where stu_no = #{stu_no}")
    @Results({
            @Result(property = "stuNo" ,column="stu_no"),
            @Result(property = "stuSex",column = "stu_sex"),
            @Result(property = "birth",column = "stu_birth")
    })
   List<Student> getAll(String stu_no);

    @Insert("insert into student (stu_no,stu_name,stu_sex,stu_birth)values(#{stuNo},#{stuName},#{stuSex},#{birth})")
    int addStudent(Student student);

    @Delete("delete from student where stu_no = #{stu_no}")
    int delOne(String stu_no);

    @Update("update student set stu_name = #{stuName} where stu_no = #{stuNo}")
    int uptStudent(Student student);

}

 

mybatis缓存

MyBatis 中的缓存就是说 MyBatis 在执行一次SQL查询或者SQL更新之后,这条SQL语句并不会消失,而是被MyBatis 缓存起来,当再次执行相同SQL语句的时候,就会直接从缓存中进行提取,而不是再次执行SQL命令。

mybatis的缓存机制有两级:

(1)一级缓存:一级缓存mybatsi已经为我们自动开启,不用我们手动操作,而且我们是关闭不了的!!但是我们可以手动清除缓存。(SqlSession级别.提交事务,缓存清空)

一级缓存失效的情况:

 

(2)二级缓存:二级缓存需要我们手动开启。(全局级别 SqlSessionFactory)

 

 @Test
    public void test02(){//验证mybatis的缓存机制  一级缓存 默认开启 sqlsession级别

        try {
            InputStream resource = Resources.getResourceAsStream("config/mybatis-config.xml");
            SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(resource);
            SqlSession sqlSession = factory.openSession(true);
            StudentDao mapper1 = sqlSession.getMapper(StudentDao.class);
            StudentDao mapper2 = sqlSession.getMapper(StudentDao.class);
            System.out.println(mapper1);
            System.out.println(mapper2);
            List<Student> a1 = mapper1.getAll();
            System.out.println(a1);
            //手动提交事务 清空缓存
            sqlSession.commit();
            List<Student> a2 = mapper2.getAll();
            System.out.println(a2);

            sqlSession.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @Test
    public void test03(){//验证mybatis的缓存机制  二级缓存 需要配置mybatis-config.xml  和mapper文件

        try {
            InputStream resource = Resources.getResourceAsStream("config/mybatis-config.xml");
            SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(resource);
            SqlSession sqlSession1 = factory.openSession(true);
            SqlSession sqlSession2 = factory.openSession(true);
            SqlSession sqlSession3 = factory.openSession(true);

            StudentDao mapper1 = sqlSession1.getMapper(StudentDao.class);
            StudentDao mapper2 = sqlSession2.getMapper(StudentDao.class);
            StudentDao mapper3 = sqlSession3.getMapper(StudentDao.class);
            List<Student> a1 = mapper1.getAll();
            System.out.println(a1);
            //关闭session将查询结果写入二级缓存
            sqlSession1.close();

            //当对同一张表进行增删改操作后  二级缓存清除
            mapper3.delStudent("2021072901");
           // sqlSession3.close();

            List<Student> a2 = mapper2.getAll();
            System.out.println(a2);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

mybatis分页插件

 

实例

 

今天的分享就到此结束了

创作不易点赞评论互关三连

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/361423.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

程序员如何向架构师转型?看完就明白该怎么做了

软件行业技术开发从业人员众多&#xff0c;但具备若干年开发经验的普通的开发人员往往面临个人发展的瓶颈&#xff0c;即如何从普通开发人员转型成高层次的系统架构师和技术管理人员。想成为一名架构师&#xff0c;应当具备全面的知识体系&#xff0c;需要进行系统的学习和实践…

数组(一)-- LeetCode[26][80] 删除有序数组中的重复元素

1 删除有序数组中的重复项 1.1 题目描述 给你一个 升序排列 的数组 nums &#xff0c;请你 原地 删除重复出现的元素&#xff0c;使每个元素 只出现一次&#xff0c;返回删除后数组的新长度。元素的 相对顺序 应该保持 一致 。 由于在某些语言中不能改变数组的长度&#xff0c…

FreeRTOS与UCOSIII任务状态对比

FreeRTOS任务状态 1、运行态 正在运行的任务&#xff0c;正在使用处理器的任务。 单核处理器中任何时候都有且只有一个任务处于运行态。 2、就绪态 已经准备就绪&#xff08;非阻塞或挂起&#xff09;&#xff0c;可以立即运行但还没有运行的任务。 正在等待比自己高优先级…

Kafka——消息队列学习总结

定义 Kafka是一个分布式的基于发布/订阅模式的消息队列&#xff08;MQ)&#xff0c;主要应用于大数据实时处理领域。 模式 点对点模式 一对一&#xff0c;消费者主动拉取数据&#xff0c;消费收到后消息清除。 发布/订阅模式 一对多&#xff0c;消费者消费数据后不会清除消息…

JavaScript:使用for in不是一个很好的抉择

for in 如果让你遍历对象中的key和value&#xff0c;你第一个想到的一定是使用for in const o{name:"chengqige",age:23 } for (let key in o){console.log(key,o[key]); }看起来是没有问题的&#xff0c;但是如果我在下面加一行代码&#xff0c;输出的结果就可能让…

JUC并发编程——进程与线程

目录一、进程和线程的概念1.1 进程1.2 线程1.3 进程与线程对比二、并行和并发的概念三、线程基本应用3.1 多线程应用——异步调用一、进程和线程的概念 1.1 进程 ● 程序由指令和数据组成&#xff0c;但这些指令要运行&#xff0c;数据要读写&#xff0c;就必须将指令加载至 …

内容生态与新业务双突破,汽车之家反转逻辑将延续

2022年&#xff0c;疫情对汽车市场的影响不容忽视。但从财报来看&#xff0c;汽车之家在宏观压力下仍实现了有力的V型反转。 北京时间2月16日美股盘前&#xff0c;汽车之家发布2022Q4及全年财报。财报显示&#xff0c;其四季度实现总营收18.93亿元&#xff0c;同比增长11.8%。…

java并发笔记

文章目录HashMapput方法resize方法ConcurrentHashMapput方法initTable方法sizectl代表什么&#xff1a;扩容计数器ConcurrentHashMap的读操作会阻塞嘛AQS唤醒线程时&#xff0c;AQS为什么从后往前遍历&#xff1f;AQS为什么要有一个虚拟的head节点AQS为什么用双向链表&#xff…

无线网络渗透测试系列学习(一) - 在Windows系统下使用虚拟机安装Kali Linux操作系统

目录 引言&#xff1a; 过程&#xff1a; 配置以及安装VMware虚拟机&#xff1a; 下载Kali Linux的镜像文件&#xff1a; 在虚拟机中打开Kali Linux并执行安装&#xff1a; 配置Kali Linux操作系统&#xff1a; 调整Kal Linux中的时区&#xff1a; 重新设定管理员root的…

Sketch+摹客,100M文件上传最快47s

哈喽&#xff0c;小摹来啦~ 去年12月底&#xff0c;摹客Sketch插件上新了「规范检查工具」&#xff0c;自功能上线以来&#xff0c;小摹收到了许多的好评及赞扬。 虽好评如潮&#xff0c;但我们不会止步不前&#xff0c;将持续攻克难点&#xff0c;旨在为大家提供更加稳定高效…

考公和大厂40万年薪的offer,选哪个?

眼看毕业将至&#xff0c;相信很多小伙伴已经摩拳擦掌&#xff0c;在为毕业季就业做准备了。2023年高校毕业生规模预计1158万人&#xff0c;同比增加82万人。在资深人力资源服务家汪张明看来&#xff0c;2023年的就业态势不仅是大学毕业生数量有增加&#xff0c;还存在一定的存…

开发一个简单易用的SDK的详细步骤(超详细,超适用)

文章目录开发一个简单易用的SDK的详细步骤创建starter步骤关键点总结开发一个简单易用的SDK的详细步骤 创建starter步骤 1.新建一个 spring boot 初始化项目 2.添加依赖&#xff0c;Lombok, Spring Configuration Processor Spring Configuration Processor 的作用是自动生…

2023.2 新方案 java代码混淆 java加密 字符串加密

Java字节码可以反编译&#xff0c;特别是创业公司,很好的项目很容易被别人破解反编译,造成很严重的损失,所以本混淆方案能很好的保护源码,而且在不断迭代,增强混淆效果,异常问题处理,达到保护项目的目的&#xff1a; 本次升级包括: 2023年02年19日 : ht-confusion-project-1.8…

华为云计算之双活容灾

双活&#xff08;HyperMetro&#xff09;本地双活&#xff1a;距离≤10km同城双活&#xff1a;距离&#xff1e;10km没有主备之分&#xff0c;只有本端数据中心和远端数据中心。当一个数据中心的设备故障或数据中心故障&#xff0c;业务会自动切换到另一个数据中心继续运行&…

17_FreeRTOS事件标志组

目录 事件标志组 事件标志组与队列、信号量的区别 事件标志组相关API函数介绍 实验源码 事件标志组 事件标志位:用一个位,来表示事件是否发生 事件标志组是一组事件标志位的集合,可以简单的理解事件标志组,就是一个整数。 事件标志组的特点: 它的每一个位表示一个事件(…

如何效率搭建企业流程系统?试试低代码平台吧

编者按&#xff1a;本文介绍了一款可私有化部署的低代码平台&#xff0c;可用于搭建团队流程管理体系&#xff0c;并详细介绍了该平台可实现的流程管理功能。关键词:可视化设计&#xff0c;集成能力&#xff0c;流程审批&#xff0c;流程调试天翎是国内最早从事快速开发平台研发…

Vscode创建vue项目的详细步骤

目录 一、概述 操作的前提 二、操作步骤 一、概述 后端人员想在IDEA里面创建一个Vue的项目&#xff0c;但是这非常麻烦&#xff0c;用vscode这个前端专用软件创建就会非常快速。 操作的前提 1.安装vscode软件的步骤&#xff1a;vscode下载和安装教程和配置中文插件&#…

分析JEP 290机制的Java实现

简介 https://openjdk.org/jeps/290 Filter Incoming Serialization Data过滤传入的序列化数据 JEP290是Java官方提供的一套来防御反序列化的机制&#xff0c;其核心在于提供了一个ObjectInputFilter接口&#xff0c;通过设置filter对象&#xff0c;然后在反序列化&#xff…

springcloud+vue实现图书管理系统

一、前言&#xff1a; 今天我们来分享一下一个简单的图书管理系统 我们知道图书馆系统可以有两个系统&#xff0c;一个是管理员管理图书的系统&#xff0c;管理员可以&#xff08;1&#xff09;查找某一本图书情况、&#xff08;2&#xff09;增加新的图书、&#xff08;3&…

Python+Selenium4三大等待预期条件_web自动化(4)

目录 0. 上节回顾 1. 定位失败的原因 2. 强制等待 3. 隐式等待 4. 显式等待 【重点难点】 4.1. 实例化 WebDriverWait 对象 4.2. 指定等待条件 4.3. 等待条件的具体要求 4.3. 1. 等待条件是一个函数 4.3. 2. 返回值是布尔值 4.3. 3. 只有一个参数&#xff0c;参数值…