Dubbo3.0入门-Java版

news2024/10/7 14:07:36

Dubbo 简介

​ Apache Dubbo 是一款 RPC 服务开发框架,用于解决微服务架构下的服务治理与通信问题,官方提供了 Java、Golang 等多语言 SDK 实现。使用 Dubbo 开发的微服务原生具备相互之间的远程地址发现与通信能力, 利用 Dubbo 提供的丰富服务治理特性,可以实现诸如服务发现、负载均衡、流量调度等服务治理诉求。Dubbo 被设计为高度可扩展,用户可以方便的实现流量拦截、选址的各种定制逻辑。

​ Dubbo3 定义为面向云原生的下一代 RPC 服务框架。3.0 基于 Dubbo 2.x 演进而来,在保持原有核心功能特性的同时, Dubbo3 在易用性、超大规模微服务实践、云原生基础设施适配、安全性等几大方向上进行了全面升级。

Dobbo的基本工作流程

在这里插入图片描述
由上图可知要使用dubbo完成一次RPC调用,需要定义三类对象:

  1. 服务接口
  2. 生产者:实现具体的服务接口
  3. 消费者:生成服务代理对象,实现在本地调用远程服务

下面开始dubbo的入门案例

总览项目框架

在这里插入图片描述

创建maven作为父项目

父项目设置为dubbo-study,并在父项目中配置dubbo依赖

<properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>4.3.16.RELEASE</spring.version>
        <dubbo.version>3.0.7</dubbo.version>
        <junit.version>4.13.1</junit.version>
        <slf4j-log4j12.version>1.7.25</slf4j-log4j12.version>
        <spring-boot.version>2.3.1.RELEASE</spring-boot.version>
        <spring-boot-maven-plugin.version>2.1.4.RELEASE</spring-boot-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Spring Boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-bom</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-dependencies-zookeeper</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j-log4j12.version}</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

编写服务接口

项目名:dubbo-springboot-interface
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">
    <parent>
        <artifactId>dubbo-study</artifactId>
        <groupId>com.mxf</groupId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>dubbo-springboot-interface</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

服务接口
在这里插入图片描述

编写服务生产者

项目名:dubbo-springboot-provider
项目结构
在这里插入图片描述

导入依赖:

<properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.mxf</groupId>
            <artifactId>dubbo-springboot-interface</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <!-- dubbo -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-dependencies-zookeeper</artifactId>
            <type>pom</type>
        </dependency>

        <!-- dubbo starter -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
        </dependency>

        <!-- spring starter -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>

    </dependencies>

实现具体服务:

import com.mxf.service.HelloService;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.RpcContext;

/**
 * 用 @DubboService 注解标记,就可以实现 Dubbo 的服务暴露
 * 如果要设置服务参数,@DubboService 也提供了常用参数的设置方式。如果有更复杂的参数设置需求,则可以考虑使用其他设置方式
 * @DubboService(version = "1.0.0", group = "dev", timeout = 5000)
 */
@DubboService
public class HelloServiceImpl implements HelloService {
    @Override
    public String sayHello(String name) {
        System.out.println("Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
        return "Hello " + name;
    }
}

参考官网的内嵌ZooKeeper类

package com.mxf.config;

import org.apache.zookeeper.server.ServerConfig;
import org.apache.zookeeper.server.ZooKeeperServerMain;
import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.SmartLifecycle;
import org.springframework.util.ErrorHandler;
import org.springframework.util.SocketUtils;

import java.io.File;
import java.lang.reflect.Method;
import java.util.Properties;
import java.util.UUID;

/**
 * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
 * <p>
 * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
 * <p>
 * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
 * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
 *
 * @author Patrick Peralta
 * @author Mark Fisher
 * @author David Turanski
 */
public class EmbeddedZooKeeper implements SmartLifecycle {

    /**
     * Logger.
     */
    private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);

    /**
     * ZooKeeper client port. This will be determined dynamically upon startup.
     */
    private final int clientPort;

    /**
     * Whether to auto-start. Default is true.
     */
    private boolean autoStartup = true;

    /**
     * Lifecycle phase. Default is 0.
     */
    private int phase = 0;

    /**
     * Thread for running the ZooKeeper server.
     */
    private volatile Thread zkServerThread;

    /**
     * ZooKeeper server.
     */
    private volatile ZooKeeperServerMain zkServer;

    /**
     * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
     */
    private ErrorHandler errorHandler;

    private boolean daemon = true;

    /**
     * Construct an EmbeddedZooKeeper with a random port.
     */
    public EmbeddedZooKeeper() {
        clientPort = SocketUtils.findAvailableTcpPort();
    }

    /**
     * Construct an EmbeddedZooKeeper with the provided port.
     *
     * @param clientPort port for ZooKeeper server to bind to
     */
    public EmbeddedZooKeeper(int clientPort, boolean daemon) {
        this.clientPort = clientPort;
        this.daemon = daemon;
    }

    /**
     * Returns the port that clients should use to connect to this embedded server.
     *
     * @return dynamically determined client port
     */
    public int getClientPort() {
        return this.clientPort;
    }

    /**
     * Specify whether to start automatically. Default is true.
     *
     * @param autoStartup whether to start automatically
     */
    public void setAutoStartup(boolean autoStartup) {
        this.autoStartup = autoStartup;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isAutoStartup() {
        return this.autoStartup;
    }

    /**
     * Specify the lifecycle phase for the embedded server.
     *
     * @param phase the lifecycle phase
     */
    public void setPhase(int phase) {
        this.phase = phase;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getPhase() {
        return this.phase;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isRunning() {
        return (zkServerThread != null);
    }

    /**
     * Start the ZooKeeper server in a background thread.
     * <p>
     * Register an error handler via {@link #setErrorHandler} in order to handle
     * any exceptions thrown during startup or execution.
     */
    @Override
    public synchronized void start() {
        if (zkServerThread == null) {
            zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
            zkServerThread.setDaemon(daemon);
            zkServerThread.start();
        }
    }

    /**
     * Shutdown the ZooKeeper server.
     */
    @Override
    public synchronized void stop() {
        if (zkServerThread != null) {
            // The shutdown method is protected...thus this hack to invoke it.
            // This will log an exception on shutdown; see
            // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
            try {
                Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
                shutdown.setAccessible(true);
                shutdown.invoke(zkServer);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            // It is expected that the thread will exit after
            // the server is shutdown; this will block until
            // the shutdown is complete.
            try {
                zkServerThread.join(5000);
                zkServerThread = null;
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
                // abandoning zk thread
                zkServerThread = null;
            }
        }
    }

    /**
     * Stop the server if running and invoke the callback when complete.
     */
    @Override
    public void stop(Runnable callback) {
        stop();
        callback.run();
    }

    /**
     * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
     * is provided, only error-level logging will occur.
     *
     * @param errorHandler the {@link ErrorHandler} to be invoked
     */
    public void setErrorHandler(ErrorHandler errorHandler) {
        this.errorHandler = errorHandler;
    }

    /**
     * Runnable implementation that starts the ZooKeeper server.
     */
    private class ServerRunnable implements Runnable {

        @Override
        public void run() {
            try {
                Properties properties = new Properties();
                File file = new File(System.getProperty("java.io.tmpdir")
                        + File.separator + UUID.randomUUID());
                file.deleteOnExit();
                properties.setProperty("dataDir", file.getAbsolutePath());
                properties.setProperty("clientPort", String.valueOf(clientPort));

                QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
                quorumPeerConfig.parseProperties(properties);

                zkServer = new ZooKeeperServerMain();
                ServerConfig configuration = new ServerConfig();
                configuration.readFrom(quorumPeerConfig);

                zkServer.runFromConfig(configuration);
            } catch (Exception e) {
                if (errorHandler != null) {
                    errorHandler.handleError(e);
                } else {
                    logger.error("Exception running embedded ZooKeeper", e);
                }
            }
        }
    }

}

启动类

import com.mxf.config.EmbeddedZooKeeper;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableDubbo    // @EnableDubbo 注解必须配置,否则将无法加载 Dubbo 注解定义的服务,@EnableDubbo 可以定义在主类上
public class ProviderApplication {
    public static void main(String[] args) {
        new EmbeddedZooKeeper(2181, false).start();

        SpringApplication.run(ProviderApplication.class, args);
        System.out.println("dubbo service started");
//        new CountDownLatch(1).await();
    }
}

对应的配置文件:

dubbo:
  application:
    name: dubbo-springboot-provider
  protocol:
    name: dubbo
    port: -1
  registry:
    id: zk-registry
    address: zookeeper://127.0.0.1:2181
  config-center:
    address: zookeeper://127.0.0.1:2181
  metadata-report:
    address: zookeeper://127.0.0.1:2181

服务消费者

项目名:dubbo-springboot-consumer
项目结构:
在这里插入图片描述

依赖:

 <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <slf4j-log4j12.version>1.7.25</slf4j-log4j12.version>
        <spring-boot.version>2.3.1.RELEASE</spring-boot.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.mxf</groupId>
            <artifactId>dubbo-springboot-interface</artifactId>
            <version>${project.parent.version}</version>
        </dependency>

        <!-- dubbo -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-dependencies-zookeeper</artifactId>
            <type>pom</type>
        </dependency>

        <!-- dubbo starter -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
        </dependency>

        <!-- spring starter -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>

    </dependencies>

在本地实现调用远程服务

@SpringBootApplication
@Service
@EnableDubbo
public class ConsumerApplication {

    /**
     * @Reference 注解从 3.0 版本开始就已经废弃,改用 @DubboReference,以区别于 Spring 的 @Reference 注解
     * @DubboReference 注解将自动注入为 Dubbo 服务代理实例,使用 helloService 即可发起远程服务调用
     */
    @DubboReference
    private HelloService helloService;

    public String doSayHello(String name) {
        return helloService.sayHello(name);
    }

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ConsumerApplication.class, args);
        ConsumerApplication application = context.getBean(ConsumerApplication.class);
        String result = application.doSayHello("world");
        System.out.println("result: " + result);
    }
}

运行演示

首先启动dubbo-springboot-provider远程服务提供者
在这里插入图片描述
然后启动dubbo-springboot-consumer服务消费者
先看到服务提供者,打印接收到请求的日志:
在这里插入图片描述
消费者获取到服务提供者的处理结果
在这里插入图片描述

总结

step1: 编写远程服务接口
step2: 编写服务提供者
1. 实现远程服务接口
2. 使用@DubboService将服务暴露
step3: 编写服务消费者
1. 使用@DubboReference获取特定的服务实现类
2. 通过获取到的服务实现类来发起远程调用

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

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

相关文章

【软件测试】测试人终将迎来末路?测试人的我35岁就坐等失业?

目录&#xff1a;导读一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09;一句话萦绕在耳畔测试乃至测开…

02 LaTex之小tips

1.运行 2.头&#xff0b;尾 \documentclass[11pt]{article}\usepackage{algorithm, algpseudocode} \usepackage{amsmath,amssymb,amsthm} \usepackage{mathrsfs}% huaxie zimu \textwidth 16cm\textheight 22cm\oddsidemargin0cm\evensidemargin\oddsidemargin\usepackage{un…

Java#17(static)

目录 一.静态关键字static 1.静态变量(被static修饰的成员变量) 2.静态方法(被static修饰的成员方法) 扩展:工具类的简单使用 三.static关键字的注意事项 一.静态关键字static 1.静态变量(被static修饰的成员变量) 特点: (1)被该类的所有对象共享 (2)不属于对象,属于类 (3)…

版权交易平台app开发,构建版权元宇宙生态

近年来在国家的大力宣传推广下&#xff0c;人们在版权方面的保护意识逐步提高&#xff0c;大力发展版权交易市场&#xff0c;不仅是响应国家号召的体现&#xff0c;更是保护公民合法权益的重要举措。版权交易平台app的开发为创业者提供了一个全新投资方向&#xff0c;同时app还…

带你认识工厂类设计模式——简单工厂工厂方法抽象工厂简单抽象工厂反射简单抽象工厂

工厂类设计模式简单工厂模式简单工厂模式类图简单工厂实现代码实现小结工厂方法模式工厂方法模式类图工厂方法模式代码实现小结抽象工厂模式抽象工厂模式类图抽象工厂模式代码实现小结&#xff1a;用简单工厂改进抽象工厂模式简单抽象工厂模式类图简单抽象工厂模式代码实现小结…

高项 人力资源管理论文

4个过程&#xff1a; 人力资源管理简单可以归纳为以下四点&#xff1a;明确需要的人&#xff08;&#xff08;制定人力资源管理计划&#xff09;&#xff0c;找到合适的人&#xff08;组建项目团队&#xff09;&#xff0c;用好身边的人&#xff08;建设项目团队&#xff09;&…

宝塔面板一键部署芸众商城智慧商业系统 打造多终端直播分销商城

芸众商城社交电商系统前端基于vue开发&#xff0c;后端基于laravel开发&#xff0c;免费版本全开源&#xff0c;支持商用&#xff0c;可同时支持多端口部署运行&#xff1b;本教程将使用宝塔面板一键部署的方式搭建芸众商城系统&#xff0c;使用宝塔面板搭建&#xff0c;大大提…

ShardingSphere实现数据库读写分离,主从库分离,docker详细教程

一.什么是 ShardingSphere 引用官方的话&#xff1a; Apache ShardingSphere 是一款分布式的数据库生态系统&#xff0c; 可以将任意数据库转换为分布式数据库&#xff0c;并通过数据分片、弹性伸缩、加密等能力对原有数据库进行增强。 Apache ShardingSphere 设计哲学为 Dat…

计算机毕业设计ssm+vue基本微信小程序的购物商城系统

项目介绍 随着互联网的趋势的到来,各行各业都在考虑利用互联网将自己的信息推广出去,最好方式就是建立自己的平台信息,并对其进行管理,随着现在智能手机的普及,人们对于智能手机里面的应用购物平台小程序也在不断的使用,本文首先分析了购物平台小程序应用程序的需求,从系统开发…

希望所有计算机专业学生都去这些网站刷题

LeetCode 力扣&#xff0c;强推&#xff01;力扣虐我千百遍&#xff0c;我待力扣如初恋&#xff01; 从现在开始&#xff0c;每天一道力扣算法题&#xff0c;坚持几个月的时间&#xff0c;你会感谢我的&#xff08;傲娇脸&#xff09; 我刚开始刷算法题的时候&#xff0c;就选…

[vue] nodejs安装教程

介绍&#xff1a;nodejs 是一个开源的跨平台的JavaScript运行时环境&#xff0c;因此在运行前端项目时是需要安装配置相应的环境变量。 一、下载nodejs 二、安装nodejs 三、配置nodejs的环境变量 四、验证配置的nodejs 一、下载nodejs nodejs下载官网地址&#xff1a;下载 …

【C++基础】this指针

this指针 this指针作用&#xff1a; c的数据和操作也是分开存储&#xff0c;并且每一个非内联成员函数只会诞生一份函数实例&#xff0c;也就是说多个同类型的对象会共用同一块代码。所以&#xff0c;用this指针表明哪个对象调用自己。 定义&#xff1a; this指针指向被调用的…

Day08--自定义组件的behaviors(等用于vue中的mixins)

1.啥子是behaviors呢&#xff1f; ************************************ ************************************ ************************************ ************************************ ************************************ ************************************ 2…

基地树洞 | 自动化小系列之番外篇

程序员或许只是一份工作&#xff0c;编码或许是为了生存&#xff0c;但是归根结底&#xff0c;我们为什么要写代码&#xff1f; 有没有⼀种可能&#xff0c;在我们的日常工作生活中&#xff0c;代码的初衷就是为了提升工作作效率&#xff0c;减少不必要的重复&#xff01; 今…

钱包追踪分析的 3 个使用案例

Nov. 2022, Vincy Data Source: Footprint Analytics - Wallet Profile 钱包跟踪分析让分析师了解区块链用户的链上活动和持仓情况。 在本文中&#xff0c;我们将介绍钱包分析器发现的一些指标。 Footprint Analytics - Wallet Profile Footprint Analytics 从中挑选相对比较…

JVM 核心技术 - 知识点整理

JVM 核心技术 JAVA 前言 JDK (Java Development Kit) JRE 开发工具JRE(Java Runtime Environment) JVM (Java Virtual Machine) 类库一次编译&#xff0c;到处执行的原理&#xff1a; java字节码可以在有JVM的环境中运行&#xff0c;不关心操作系统的版本&#xff0c;减少…

Spring Cloud版本,Spring Boot版本详细对应关系

目录 一、官网&#xff08;网页版&#xff09; 二、官网&#xff08;API接口&#xff09; 三、根据历史官方文档梳理、保存的表格 四、官方&#xff08;wiki&#xff09;Spring Cloud的各个组件与Spring Boot支持、对应关系 有多个方式可以查看Spring Boot和Spring Cloud版本…

嵌入式分享合集107

一、Wi-Fi HaLow Wi-Fi HaLow很快就会出现在我们日常生活中的智慧门锁、安保摄影机、可穿戴设备和无线传感器网络上。什么是Wi-Fi HaLow&#xff1f;与传统的Wi-Fi&#xff08;4/5/6&#xff09;有何不同&#xff1f;究竟是什么让Wi-Fi HaLow成为物联网的理想协议&#xff1f;…

【初阶数据结构】——带头双向循环链表(C描述)

文章目录前言带头双向循环链表实现1. 结构介绍2. 结点创建3. 初始化4. 销毁5. 头插6. 头删7. 尾插8. 尾删9. 打印10. 查找11. 在pos之前插入数据12. 删除pos位置13. 判空14. 计算大小源码展示1. DoubleList.h2. DoubleList.c3. Test.c前言 上一篇文章我们学习了单链表&#xff…

SpringBoot自动装配原理

目录一、前言二、SpringBoot自动装配核心源码2.1、SpringBootApplication2.2、EnableAutoConfiguration2.3、Import(AutoConfigurationImportSelector.class)2.3.1、selectImports方法2.3.2、getAutoConfigurationEntry方法2.3.3、getCandidateConfigurations方法2.3.4、Spring…