springboot浅析

news2025/2/28 11:10:19
springboot浅析
什么是springboot?

实际上springboot就是一个给我们提供了快速搭建使用spring的一种方式,让我们省去了繁琐的xml配置。

为什么无需进行大量的xml配置,就是因为springboot是基于约定优于配置的思想,简单来说就是遵循约定。

spring的优缺点

了解原理前我们来回顾一下spring的优缺点

优点:简单概括就是spring为企业级java开发提供了一种相对简单的方法,通过依赖注入和面向切面编程,就是我们熟悉的IOC和AOP,用简单的java对象实现了EJB(Enterprise Java Beans技术的简称, 又被称为企业Java Beans)的功能

缺点:1、虽然spring组件是轻量级的,但是spring的配置却是重量级的,我们都用过spring,一开始spring使用xml进行配置的,而且非常多的xml配置,后面spring迭代了很多版本,慢慢引入了组件扫描,引入了基于java的配置用于替代xml,但是所有的这些配置都代表了开发时的损耗,影响了开发效率 2、spring的项目依赖管理也是一件耗时耗力的工作,在搭建项目的时候我们要随时分析需要导入哪些库,库所依赖的版本关系,一担导入错误,是一件非常麻烦的事情。

总结来说spring的缺点就是配置繁琐和项目依赖管理耗时耗力

针对以上spring的缺点所以有了springboot!

我们来看看spring是怎么样来解决spring的问题的,简单描述下就是

1、起步依赖

起步依赖本质上就是一个Maven项目对象模型,定义了对其他哭的传递依赖,这些东西加载一起即支持某项功能。简单来说,就是把具备某种功能的坐标打包到一起,并提供一些默认的功能,比如我们熟悉的springweb

2、自动配置

指的是springboot会自动将一些配置类的bean注册进IOC容器中,我们可以在需要的地方使用注解@Autowired、@Resource来使用它,自动就是我们只需要引用我们想用功能的包,相关的配置我们可以完全不用管,可能只需要配置一些用户名密码等相关基础的配置,springboot会自动注入这些配置好的bean,我们直接使用即可

下面我们来简单来分析下springboot是怎么样来实现依赖管理和自动配置的

1.0 依赖管理

首相我们想个问题

为什么我们项目pom里面dependency里面有的依赖有<version>版本号,有的依赖没有引入<version>版本号?

我们打开我们项目的pom文件,我们可以看淡我们配置的pom.xml都依赖了父依赖启动器,parent中就已经对版本进行了统一管理

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">
    <parent>
        <groupId>cn.xx.maven</groupId>
        <artifactId>dependencies</artifactId>
        <version>xx.xx</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <groupId>cn.sxw.demo</groupId>
    <artifactId>demo-api-pom</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <modules>
        <module>web</module>
    </modules>
    <packaging>pom</packaging>

我们可以看到父pom文件里面的<properties>节点里面就配置了相关的版本号,<dependencyManagement>节点就声明所依赖的jar包的版本号等信息,那么所有子项目再次引入此依赖jar包时则无需显式的列出版本号,Maven会沿着父子层级向上寻找拥有dependencyManagement 元素的项目,然后使用它指定的版本号。

所以以此springboot就解决了我们版本依赖管理耗时耗力的问题

需要注意的是如果我们引入的依赖不是parent里面管理的,我们就需要加上<version>版本号

其次我们项目运行依赖的jar是从什么地方来的?

这里就引申出一个很重的东西starter,比如stater-web

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starters</artifactId>
      <version>1.5.21.RELEASE</version>
   </parent>
   <artifactId>spring-boot-starter-web</artifactId>
   <name>Spring Boot Web Starter</name>
   <description>Starter for building web, including RESTful, applications using Spring
      MVC. Uses Tomcat as the default embedded container</description>
   <url>https://projects.spring.io/spring-boot/</url>
   <organization>
      <name>Pivotal Software, Inc.</name>
      <url>https://www.spring.io</url>
   </organization>
   <properties>
      <main.basedir>${basedir}/../..</main.basedir>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-tomcat</artifactId>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
      </dependency>
      <dependency>
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-databind</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-web</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-webmvc</artifactId>
      </dependency>
   </dependencies>
</project>

从上述代码可以发现,spring-boot-starter-web依赖启动器的主要作用是提供web开发所需的底层的所有依赖,提供web开发所需要的依赖,不需要我们再去导入tomcat、webmvc等相关的依赖,这就是springboot所使用的依赖传递

springboot不止是提供了web启动器,还提供很多其他的启动器,我们可以去官网查看,地址:

https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.build-systems.starters

这个里面也不是提供了所有开发的技术框架都提供了启动器,后面我们可以自定义starter,后面学习下!!

2.0自动配置

springboot到底是如何进行自动配置的,都把哪些组件进行了自动配置?

我们来看一下springboot项目启动类

@SpringBootApplication
public class MyWebApplication {

    public static void main(String[] args) {
        SpringApplication.run(TeachingApiWebApplication.class, args);
    }
}

@SpringBootApplication 扫描spring组件并自动配置springboot

@SpringBootApplication就是一个组合注解

@Target(ElementType.TYPE)            // 注解的适用范围,其中TYPE用于描述类、接口(包括包注解类型)或enum声明
@Retention(RetentionPolicy.RUNTIME)  // 注解的生命周期,保留到class文件中(三个生命周期)
@Documented                          // 表明这个注解应该被javadoc记录
@Inherited                           // 子类可以继承该注解

@SpringBootConfiguration             // 继承了Configuration,表示当前是注解类(配置类可以被组件扫描器扫描到的)
@EnableAutoConfiguration             // 启动自动配置功能(里面又是@AutoConfigurationPackage 自动配置包,会把@SpringBootApplication注解标注的类所在包名拿到,并且会对该包及其子包进行扫描,将组件添加到容器中 ,@AutoConfigurationPackage这个里面又是以
@Import(AutoConfigurationPackages.Registrar.class) spring框架底层注解,他的作用是给容器中导入某个组件类,在这里他是将Registrar这个组件类导入到容器中)
@ComponentScan(excludeFilters = {    //包扫码器 扫描路径设置(具体使用待确认)
@Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
@Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) })

总结:

springboot底层实现自动配置步骤:

  1. springboot应用启动

  2. @SpringBootApplication起作用

  3. @EnableAutoConfiguration 启动自动配置功能

  4. @Import(AutoConfigurationPackages.Registrar.class):它通过将Registrar类导入到容器中,而Registrar类作用是扫描配置类统计目录及其子包,并将相应的组件导入到springboot创建管理的容器中

  5. @Import(EnableAutoConfigurationImportSelector.class):它通过将AutoConfigurationImportSelector类导入到容器中,AutoConfigurationImportSelector类作用是通过String[] selectImports方法执行过程中,会使用内部工具类springFacoriesLoader查找classpath上所有jar包中的META-INF/spring-facories进行加载,实现将配置类信息交给springFactory加载器进行一系列的容器创建过程

3.0自定义starter
**starter是什么?**

我们可以把它理解成为一个可插拔式的插件,有了这些starter我们使用某些功能的时候,就不需要去关注各种依赖的处理,不需要我们去配置那些复杂的配置信息,由springboot自动通过classpath路径下的类发现我们需要的bean,并注入相应的bean。

**为什么要自定义starter?**

    在我们一般的开发过程中,经常会有一些独立于业务之外的配置模块或独立的一些功能。我们只需要将这些独立于业务代码之外的功封装成一个starter,用的时候我们只需要将其在pom文件中引入即可,springboot就会根据我们引入的starter依赖,完成自动配置

**自定义starter命名规则**

springboot官方旗下项目,前缀以spring-boot-starter- 【模块名】 ,例如:spring-boot-starter- web、spring-boot-starter- json等等,为了与官方的starter区别开来, 我们自定义的starter以 【模块】-spring-boot-starter来进行命名,比如我们使用druid的  druid-spring-boot-starter,用的swagger的 swagger-spring-boot-starter等等。**这样我们就可以一眼看出是官方的提供的starter还是第三方提供的starter**。

自定义starter我们分为两步:

①、自定义starter

        (1) 新建maven 工程,工程名myfirst-spring-boot-starter,导入依赖
<properties>
    <spring.version>2.2.2.RELEASE</spring.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure-processor</artifactId>
        <version>${spring.version}</version>
        <optional>true</optional>
    </dependency>
</dependencies>

(2) 编写一个MyProperties

@EnableConfigurationProperties(MyProperties.class)
@ConfigurationProperties(prefix = "first")
public class MyProperties {

    private int id;
    private String name;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
 (3) 编写配置类MyConfiguration
@Configuration
@ConditionalOnClass(MyConfiguration.class)  //当类路径classpath下有指定类的情况下就会进行自动配置
public class MyConfiguration {

    static {
        System.out.println("MyConfiguration init----------------------");
    }

    @Bean
    public MyProperties myProperties(){
        return new MyProperties();
    }

}

(4) 在resource下面新建文件夹META-INF创建一个spring.factories文件,文件内容如下

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.dy.common.mystarter.configuration.MyConfiguration
②、使用starter

(1) pom引入starter

<dependency>
    <groupId>cn.dy</groupId>
    <artifactId>myfirst-spring-boot-starter</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>
(2) yml文件里面定义我们自定义starter里面myproperties里面的first-starter
first:
  id: 1
  name: 'hello'

(3) 引用myproperties

    @Autowired
    private MyProperties myProperties;

    @Override
    public String getMyProperties() {
        return myProperties.toString();
    }
4.0 执行原理

springboot项目都有一个启动类主要执行SpringApplication.run(CommonServerApplication.class, args);
进入run方法里面我们可以看到代码

 public static ConfigurableApplicationContext run(Class<?> primarySource, String... args) {
        return run(new Class[]{primarySource}, args);
    }

    public static ConfigurableApplicationContext run(Class<?>[] primarySources, String[] args) {
        return (new SpringApplication(primarySources)).run(args);
    }

里面主要做了两个事实例化springapplication并且执行他的run方法启动项目
实例化springapplication,具体核心代码如下

    public SpringApplication(Class<?>... primarySources) {
        this(null, primarySources);
    }

    /**
     * Create a new {@link SpringApplication} instance. The application context will load
     * beans from the specified primary sources (see {@link SpringApplication class-level}
     * documentation for details. The instance can be customized before calling
     * {@link #run(String...)}.
     * @param resourceLoader the resource loader to use
     * @param primarySources the primary bean sources
     * @see #run(Class, String[])
     * @see #setSources(Set)
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) {
        this.resourceLoader = resourceLoader;
        Assert.notNull(primarySources, "PrimarySources must not be null");
        this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources));
        this.webApplicationType = WebApplicationType.deduceFromClasspath();
        this.bootstrapRegistryInitializers = getBootstrapRegistryInitializersFromSpringFactories();
        setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class));
        setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class));
        this.mainApplicationClass = deduceMainApplicationClass();
         }

看源码可以看到实例化springapplication做了几件事

  • 根据classpath里面是否存在某个特征类(org.springframework.web.context.ConfigurableWebApplicationContext)来决定是否应该创建一个为Web应用使用的ApplicationContext类型。

  • 使用SpringFactoriesLoader在应用的classpath中查找并加载所有可用的ApplicationContextInitializer。

  • 使用SpringFactoriesLoader在应用的classpath中查找并加载所有可用的ApplicationListener。

  • 推断并设置main方法的定义类。

    4.2 执行springapplication的run方法

SpringApplication实例初始化完成并且完成设置后,就开始执行run方法的逻辑了,方法执行伊始,首先遍历执行所有通过SpringFactoriesLoader可以查找到并加载的SpringApplicationRunListener。调用它们的started()方法,告诉这些SpringApplicationRunListener,SpringBoot应用要开始执行。

public ConfigurableApplicationContext run(String... args) {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        ConfigurableApplicationContext context = null;
        Collection<SpringBootExceptionReporter> exceptionReporters = new ArrayList<>();
        configureHeadlessProperty();
//1.通过SpringFactoriesLoader查找并加载所有的SpringApplicationRunListeners,通过调用
//starting()方法通知所有的SpringApplicationRunListeners:应用开始启动了
        SpringApplicationRunListeners listeners = getRunListeners(args);
        listeners.starting();
        try {
          //2.创建并配置当前应用将要使用的Environment
            ApplicationArguments applicationArguments = new                                   DefaultApplicationArguments(
                    args);
            ConfigurableEnvironment environment = prepareEnvironment(listeners,
                    applicationArguments);
            configureIgnoreBeanInfo(environment);
            //3.打印banner
            Banner printedBanner = printBanner(environment);
            //4.根据是否是web项目,来创建不同的ApplicationContext容器
            context = createApplicationContext();
            //5.创建一系列FailureAnalyzer
            exceptionReporters = getSpringFactoriesInstances(
                    SpringBootExceptionReporter.class,
                    new Class[] { ConfigurableApplicationContext.class }, context);
             //6.初始化ApplicationContext
            prepareContext(context, environment, listeners, applicationArguments,
                    printedBanner);
            //7.调用ApplicationContext的refresh()方法,刷新容器
            refreshContext(context);
            //8.查找当前context中是否注册有CommandLineRunner和ApplicationRunner,如果                  有则遍历执行它们。
            afterRefresh(context, applicationArguments);
            stopWatch.stop();
            if (this.logStartupInfo) {
                new StartupInfoLogger(this.mainApplicationClass)
                        .logStarted(getApplicationLog(), stopWatch);
            }
            listeners.started(context);
            callRunners(context, applicationArguments);
        }
        catch (Throwable ex) {
            handleRunFailure(context, listeners, exceptionReporters, ex);
            throw new IllegalStateException(ex);
        }
        listeners.running(context);
        return context;
    }


喜欢的朋友记得点赞、收藏、关注哦!!!

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

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

相关文章

【文件基础操作】小笔记

Step1: 现在项目文件夹&#xff08;我的项目叫做RunPony&#xff09;下创建一个a.txt文本文件&#xff0c;手动写入一些数字&#xff0c;保存 Step2: 现在在main.c内写一个基本的文件处理的程序 Step3: 现在已经知道如何打开关闭文件&#xff0c;下一步要搞懂如何读取txt内的…

SSL 证书是 SSL 协议实现安全通信的必要组成部分

SSL证书和SSL/TLS协议有着密切的关系&#xff0c;但它们本质上是不同的概念。下面是两者的区别和它们之间的关系的表格&#xff1a; 属性SSL/TLS 协议SSL证书英文全称SSL&#xff08;Secure Sockets Layer&#xff09;&#xff0c;TLS&#xff08;Transport Layer Security&am…

AI问答-供应链管理:排队模型M/D/5/100/m/FCFS代表的含义是什么

在供应链管理中&#xff0c;排队模型M/D/5/100/m/FCFS代表的含义如下&#xff1a; M&#xff1a; 表示顾客到达时间间隔服从负指数分布&#xff08;Markov&#xff0c;负指数分布具有无记忆性&#xff09;&#xff0c;即顾客到达是随机的&#xff0c;且到达时间间隔服从指数分…

Linux驱动学习(四)--字符设备注册

上一节讲到的字符设备注册与销毁是通过cdev_init、cdev_add、cdev_del等函数分步执行的&#xff0c;本小节用一种更简单的方式&#xff0c;来注册字符设备 register_chrdev 如果major为0&#xff0c;该函数将动态的分配一个主设备号并且返回对应的值如果major > 0&#xff…

30天开发操作系统 第24天 -- 窗口操作

一、窗口切换 1.0 前天开始我们的应用程序可以显示自己的窗口了&#xff0c;现在画面上到处都是窗口&#xff0c;我们急需能够 切换窗口顺序的功能&#xff0c;使得在需要的时候可以查 看最下面的窗口的内容。这个功能看起来不难&#xff0c;我们马上来实现它。 不过&#xf…

Visual Studio 中 C/C++ 函数不安全警告(C4996)终极解决方案:分场景实战指南

问题描述 在 Visual Studio 中编写 C/C 代码时&#xff0c;使用 scanf、strcpy、fopen 等传统函数会触发以下警告&#xff1a; C4996: xxx: This function or variable may be unsafe. Consider using xxx_s instead. 根本原因&#xff1a; 这些函数缺乏缓冲区溢出检查&#…

提升数据洞察力:五款报表软件助力企业智能决策

概述 随着数据量的激增和企业对决策支持需求的提升&#xff0c;报表软件已经成为现代企业管理中不可或缺的工具。这些软件能够帮助企业高效处理数据、生成报告&#xff0c;并将数据可视化&#xff0c;从而推动更智能的决策过程。 1. 山海鲸报表 概述&#xff1a; 山海鲸报表…

Materials Studio MS2020在linux系统上的安装包下载地址 支持centos Ubuntu rocky等系统

下载地址&#xff1a;MS2020-linux官方版下载丨最新版下载丨绿色版下载丨APP下载-123云盘 Materials Studio 2020是一款功能强大的材料科学计算模拟软件&#xff0c;以下是其详细介绍&#xff1a; 核心模块功能 CASTEP模块&#xff1a;采用平面波赝势方法&#xff0c;适用于周…

【语音编解码】常用的基于神经网络的语音编解码方案对比

引言 随着实时通信与多媒体应用的爆炸式增长&#xff0c;传统语音编解码技术正面临带宽效率与音质保真的双重挑战。近年来&#xff0c;基于深度学习的神经编解码器突破性地将端到端架构、动态码率控制与可解释信号处理相结合&#xff0c;在3kbps以下超低码率场景仍能保持自然语…

DeepSeek行业应用实践报告-智灵动力【112页PPT全】

DeepSeek&#xff08;深度搜索&#xff09;近期引发广泛关注并成为众多企业/开发者争相接入的现象&#xff0c;主要源于其在技术突破、市场需求适配性及生态建设等方面的综合优势。以下是关键原因分析&#xff1a; 一、技术核心优势 开源与低成本 DeepSeek基于开源架构&#xf…

a_init: Unable to get log name. Retval:[-4]是什么故障

突然 接到监控告警 aix数据库内存使用超过阈值&#xff0c;请分析 先看内存使用吧 topas中能看到comp内存使用79%&#xff0c;非计算9% 看看哪个进程占用多呢 占用内存最高的20个进程(aix) ps aux |head -1 ; ps aux|sort -rn 4 |head -20看到rbal进程占用11%&#xff0c;比…

利用node.js搭配express框架写后端接口(一)

Node.js 凭借其高效的非阻塞 I/O 操作、事件驱动架构以及轻量级的特点&#xff0c;成为了开发高性能服务器应用的热门选择。Express 框架作为 Node.js 上最流行的 Web 应用框架之一&#xff0c;以其简洁的 API 和丰富的中间件生态系统&#xff0c;极大地简化了 Web 后端开发流程…

CentOS中shell脚本对多台机器执行下载安装

1.建立免密ssh连接 详情见这篇&#xff1a; CentOS建立ssh免密连接&#xff08;含流程剖析&#xff09;-CSDN博客 2.脚本编写 我这里只是简单写了个demo进行演示&#xff0c;如果服务器很多可以先暂存成文件再逐行读取host进行连接并执行命令 用node1去ssh连接node2和node…

深入剖析:自定义实现C语言中的atoi函数

在C语言的标准库中&#xff0c; atoi 函数是一个非常实用的工具&#xff0c;它能够将字符串形式的数字转换为对应的整数。然而&#xff0c;当我们深入探究其实现原理时&#xff0c;会发现其中蕴含着许多有趣的编程技巧和细节。本文将详细讲解如何自定义实现一个类似 atoi 功能的…

Flutter 学习之旅 之 flutter 在 Android 端读取相册图片显示

Flutter 学习之旅 之 flutter 在 Android 端读取相册图片显示 目录 Flutter 学习之旅 之 flutter 在 Android 端读取相册图片显示 一、简单介绍 二、简单介绍 image_picker 三、安装 image_picker 四、简单案例实现 五、关键代码 代码说明&#xff1a; 一、简单介绍 Fl…

数据结构秘籍(一)线性数据结构

1.数组 数组&#xff08;Array&#xff09;是一种很常见的数据结构。它由相同类型的元素&#xff08;element&#xff09;组成&#xff0c;并且是使用一块连续的内存来存储。 我们直接可以利用元素的索引&#xff08;index&#xff09;计算出该元素对应的存储地址。 数组的特…

Linux(centos)系统安装部署MySQL8.0数据库(GLIBC版本)

前言 MySQL 是一款开源的关系型数据库管理系统&#xff08;RDBMS&#xff09;&#xff0c;主要用于‌结构化数据的存储、管理和检索‌。 一、检查环境 安装前检查服务器glibc版本&#xff0c;下载对应版本包 rpm -qa | grep glibc mysql安装包及依赖包已整理好&#xff0c…

Redis缓存一致性难题:如何让数据库和缓存不“打架”?

标题&#xff1a;Redis缓存一致性难题&#xff1a;如何让数据库和缓存不“打架”&#xff1f;&#xff08;附程序员脱发指南&#xff09; 导言&#xff1a;当数据库和缓存成了“异地恋” 想象一下&#xff1a;你刚在美团下单了一份麻辣小龙虾&#xff0c;付款后刷新页面&#…

【R包】pathlinkR转录组数据分析和可视化利器

介绍 通常情况下&#xff0c;基因表达研究如微阵列和RNA-Seq会产生数百到数千个差异表达基因&#xff08;deg&#xff09;。理解如此庞大的数据集的生物学意义变得非常困难&#xff0c;尤其是在分析多个条件和比较的情况下。该软件包利用途径富集和蛋白-蛋白相互作用网络&…

1.68M 免安装多格式图片批量转 webp 无广告软件推荐

软件介绍 今天要给大家分享一款超实用的图片处理工具&#xff0c;它能实现多格式图片向 webp 格式的转换&#xff0c;无论是 jpg、png、tif、gif 还是 webp 格式自身的图片&#xff0c;都能批量且借助多线程技术进行转换。 直接打开就能用&#xff0c;体积小巧&#xff0c;仅 …