框架体系——Spring

2023/11/30 8:35:31

Spring IOC

IOC控制反转

  • IOC 控制反转,全称Inverse of Control,是一种设计理念
  • 由代理人来创建和管理对象,消费者通过代理人来获取对象
  • Ioc的目的是降低对象之间的耦合
  • 通过加入Ioc容器将对象统一管理,将对象关联变为弱耦合。
    在这里插入图片描述

DI依赖注入

  • IoC是设计理念,是现代程序设计遵循的标准,是宏观目标
  • DI(Dependency Injection)是具体技术实现,是微观实现。
  • DI在java中就是利用反射技术实现对象注入(Injection)

Spring

  • Spring可以从狭义和广义两个角度看待
  • 狭义的Spring是指Spring框架(Spring Framework)
  • 广义的Spring是指Spring生态体系

狭义的Spring框架

  • Spring框架是企业开发复杂性的一站式解决方案
  • Spring框架的核心是IoC容器与AoP面向切面编程
  • Spring IoC负责创建与管理系统对象,并在此基础上拓展功能

广义的Spring框架

Spring 全家桶,包括Spring data,springboot,springcloud等等

传统开发方式

  • 对象直接引用导致对象硬性关联,程序难以维护拓展
  • 在这里插入图片描述

Spring IoC容器

  • IoC容器是Spring生态的地基,用于统一创建与管理对象依赖
    在这里插入图片描述
    Spring IoC容器职责
  • 对象的控制权交由第三方统一管理
  • 利用Java反射技术实现运行时对象创建与关联(DI依赖注入)
  • 基于配置提高应用程序的可维护性与拓展性

Spring IoC初体验

需求
在这里插入图片描述
下面是普通的代码实现,将child和apple进行强关联,这就出现了一个问题,灵活性不高,如果我想修改,就必须改动源代码

    public static void main(String[] args) {
        Apple apple1 = new Apple("红富士", "红色", "欧洲");
        Apple apple2 = new Apple("绿富士", "绿色", "绿大利");
        Apple apple3 = new Apple("蓝富士", "蓝色", "兰博基尼");
        Child lily = new Child("lily", apple1);
        Child andy = new Child("andy", apple2);
        Child luna = new Child("luna", apple3);
        lily.eat();
        andy.eat();
        luna.eat();
    }

针对这个问题,Spring应运而生,下面我们使用Spring来实现上述逻辑

Spring
首先,引入Spring的依赖

 <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.3.11.RELEASE</version>
        </dependency>
    </dependencies>

下面是几大重要的包
在这里插入图片描述

接着在resources下新建applicationContext.xml,增加配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd">
<!--在IoC容器启动时,自动由Spring实例化Apple对象,取名sweetApple放入容器中-->
<bean id="sweetApple" class="com.imooc.imooc.spring.ioc.eneity.Apple">
    <property name="title" value="红富士"></property>
    <property name="origin" value="欧洲"></property>
    <property name="color" value="红色"></property>
</bean>

    <bean id="sourApple" class="com.imooc.imooc.spring.ioc.eneity.Apple">
        <property name="title" value="青苹果"></property>
        <property name="origin" value="中亚"></property>
        <property name="color" value="绿色"></property>
    </bean>

    <bean id="softApple" class="com.imooc.imooc.spring.ioc.eneity.Apple">
        <property name="title" value="金帅"></property>
        <property name="origin" value="中国"></property>
        <property name="color" value="黄色"></property>
    </bean>
</beans>

然后新建SpringApplication类,看看获取对象

package com.imooc.imooc.spring.ioc.eneity;

import com.imooc.imooc.spring.ioc.Application;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/22 19:34
 * @Version 1.0
 */
public class SpringApplication {
    public static void main(String[] args) {
        ApplicationContext context =new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
       Apple sweetApple =  context.getBean("sweetApple",Apple.class);
        System.out.println(sweetApple.getTitle());
    }
}

配置Bean的三种方式

Spring框架有三种配置Bean的方式,分别是 XML配置Bean)基于注解配置Bean基于Java代码配置Bean
下面我们详细学习如何通过XML配置Bean;

实例化bean的三种方法

而使用XML配置bean,也有三种实例化Bean方法 基于构造方法对象实例化、基于静态工厂实例化、基于工厂实例方法实例化
在这里插入图片描述

下面是通过工厂类实例化对象,优势在于隐藏了对象创建的细节。
首先是配置:

 <bean id="apple4" class="com.imooc.spring.ioc.factory.AppleStaticFactory" factory-method="CreateSweetApple"/>

    <!-- 使用工厂实例创建对象-->
    <bean id="factoryInstance" class="com.imooc.spring.ioc.factory.ApplyFactoryInstance"></bean>
    <bean id="apple5" factory-bean="factoryInstance" factory-method="createSweetApple"/>

然后是两个工厂及其方法:

public class ApplyFactoryInstance {
    public Apple createSweetApple(){
        Apple apple =new Apple();
        apple.setOrigin("欧洲");
        apple.setColor("红色");
        apple.setTitle("红富士");
        return apple;
    }
}

public class AppleStaticFactory {
    public static Apple CreateSweetApple(){
        Apple apple =new Apple();
        apple.setOrigin("欧洲");
        apple.setColor("红色");
        apple.setTitle("红富士");
        return apple;
    }
}

初始化完成后,我们如何从Ioc容器中获取bean呢?有两种方式,分别如下:
在这里插入图片描述

另外,其实在xml中 bean有IDName两个属性,这两个属性有什么区别呢?
首先,我们来看看他们的相同点:

  • bean id 和name都是设置对象在IoC容器中的唯一标识
  • 两者在同一个配置文件中都不允许重复
  • 两者允许在多个配置文件中出现重复,新对象覆盖旧对象

两者不同点:

  • id要求更为严格,一次只能定义一个对象标识(推荐)
  • name更为宽松,一次允许定义多个对象标识
  • tips:id和name命名要求有意义,且驼峰命名
    除此之外,其实Spring还支持无ID/name属性,此时使用类名全路径作为唯一标识。

对象依赖注入

  • 依赖注入是指运行时将容器内对象利用反射赋给其他对象的操作
  • 基于Setter注入对象
  • 基于构造方法注入对象

IOC在项目中的重要用途

示例代码如下:
在这里插入图片描述

ApplicationContext-service.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="bookService" class="com.imooc.spring.ioc.bookshop.service.BookService">
        <property name="bookDao" ref="bookDao"></property>
    </bean>
</beans>

ApplicationContext-dao.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="bookDao" class="com.imooc.spring.ioc.bookshop.dao.BookDaoImpl"></bean>
</beans>

BookDao

package com.imooc.spring.ioc.bookshop.dao;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/24 22:42
 * @Version 1.0
 */
public interface BookDao {
    public void insert();
}

BookDaoImpl

package com.imooc.spring.ioc.bookshop.dao;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/24 22:42
 * @Version 1.0
 */
public class BookDaoImpl implements BookDao{

    public void insert() {
        System.out.println("向Mysql Book 表插入一条数据");
    }
}

bookShopApplication

package com.imooc.spring.ioc.bookshop;

import com.imooc.spring.ioc.bookshop.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/24 22:47
 * @Version 1.0
 */
public class bookShopApplication {
    public static void main(String[] args) {
        ApplicationContext context =  new ClassPathXmlApplicationContext("classpath:ApplicationContext-*.xml");
        BookService bookService = context.getBean("bookService",BookService.class);
        bookService.purchase();
    }
}

实现对象依赖注入有两种方式:setter方法注入/构造方法注入

区别在于xml‘中bean参数 一个使用 property 一个使用 constructor-arg

注入集合对象

1. 注入List:
在这里插入图片描述

2. 注入set
在这里插入图片描述

3. 注入map
在这里插入图片描述

  1. 注入Properties
    在这里插入图片描述

示例代码:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd">

    <!--list可重复-->
   <!-- <bean id="company" class="com.imooc.spring.ioc.entity.Company">
        <property name="rooms">
            <list>
                <value>2001-总裁办</value>
                <value>2003-总经理办公室</value>
                <value>2010-研发部会议室</value>
                <value>2010-研发部会议室</value>
            </list>
        </property>
    </bean>-->
<!-- set 可重复 -->
    <bean id="c1" class="com.imooc.spring.ioc.entity.Computer">
        <constructor-arg name="brand" value="联想"></constructor-arg>
        <constructor-arg name="type" value="台式机"></constructor-arg>
        <constructor-arg name="sn" value="8389283012"></constructor-arg>
        <constructor-arg name="price" value="3085"></constructor-arg>
    </bean>

    <bean id="company" class="com.imooc.spring.ioc.entity.Company">
        <property name="rooms">
            <set>
                <value>2001-总裁办</value>
                <value>2003-总经理办公室</value>
                <value>2010-研发部会议室</value>
                <value>2010-研发部会议室</value>
            </set>
        </property>

        <property name="computers">
            <map>
                <entry key="dev-880172" value-ref="c1"></entry>

                <entry key="dev-88173">
                    <bean class="com.imooc.spring.ioc.entity.Computer">
                        <constructor-arg name="brand" value="华为"></constructor-arg>
                        <constructor-arg name="type" value="笔记本"></constructor-arg>
                        <constructor-arg name="sn" value="8389283013"></constructor-arg>
                        <constructor-arg name="price" value="5085"></constructor-arg>
                    </bean>
                </entry>
            </map>
        </property>

        <property name="info">
            <props>
                <prop key="phone">010-12345678</prop>
                <prop key="address">湖北省武汉市xx中心</prop>
                <prop key="website">http:www.baidu.com</prop>
            </props>
        </property>
    </bean>
</beans>

查看容器内对象

示例代码:

package com.imooc.spring.ioc;

import com.imooc.spring.ioc.entity.Company;
import com.imooc.spring.ioc.entity.Computer;
import javafx.application.Application;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/24 23:09
 * @Version 1.0
 */
public class SpringApplication {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:ApplicationContext.xml");
        Company company = context.getBean("company", Company.class);
        System.out.println(company);
        System.out.println(company.getInfo().getProperty("website"));
		// 获取容器内对象名称
        String[] beanNames = context.getBeanDefinitionNames();
        for (String beanName : beanNames) {
            System.out.println(beanName);
            System.out.println("类型:"+context.getBean(beanName).getClass().getName());
            System.out.println("内容:"+context.getBean(beanName).toString());
        }
    }
}

bean scope属性

  • bean scope 属性用于决定对象核实被创建
  • bean scope 配置将影响容器内对象的数量
  • 默认情况下bean会在IoC容器创建后自动序列化,全局唯一

bean scope属性清单

在这里插入图片描述

singleton 与 prototype对比

在这里插入图片描述

bean的生命周期

在这里插入图片描述
配置示例:
在这里插入图片描述

实现极简IoC容器(模拟Spring实现流程)

首先是IOC容器类:
接口:

package com.imooc.spring.ioc.context;

/**
 * ApplicationContext 接口
 *
 * @Author wangw
 * @Date 2022/11/26 22:15
 * @Version 1.0
 */
public interface ApplicationContext {
    public Object getBean(String beanId);
}

实现类:

package com.imooc.spring.ioc.context;

import com.imooc.spring.ioc.entity.Apple;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;

import java.lang.reflect.Method;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ApplicationContext 实现类,本质就是一个IOC容器
 *
 * @Author wangw
 * @Date 2022/11/26 22:16
 * @Version 1.0
 */
public class ClassPathXmlApplicationContext implements ApplicationContext {
    private Map iocContainer = new HashMap();

    public ClassPathXmlApplicationContext() {
        try {
            String filePath = this.getClass().getResource("/applicationContext.xml").getPath();
            filePath = new URLDecoder().decode(filePath, "UTF-8");
            SAXReader reader = new SAXReader();
            Document document = reader.read(filePath);
            List<Node> nodes = document.getRootElement().selectNodes("bean");
            for (Node node : nodes) {
                Element element = (Element) node;
                String id = element.attributeValue("id");
                String className = element.attributeValue("class");
                Class class1 = Class.forName(className);
                Object obj = class1.newInstance();
                List<Node> list = element.selectNodes("property");
                for (Node node1 : list) {
                    Element property = (Element) node1;
                    String propName = property.attributeValue("name");
                    String propValue = property.attributeValue("value");
                    String setMethodName ="set"+propName.substring(0,1).toUpperCase()+propName.substring(1);
                    System.out.println("准备执行"+setMethodName+"方法注入数据");
                    Method method = class1.getMethod(setMethodName,String.class);
                    method.invoke(obj,propValue);

                }
                iocContainer.put(id, obj);
                System.out.println("ioc容器初始化完毕");
                System.out.println(iocContainer);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public Object getBean(String beanId) {
        return iocContainer.get(beanId);
    }
}

配置XML:

<?xml version="1.0" encoding="UTF-8" ?>
<beans>
    <bean id ="sweetApple" class="com.imooc.spring.ioc.entity.Apple">
        <property name="title" value="红富士"></property>
        <property name="origin" value="欧洲"></property>
        <property name="color" value="红色"></property>
    </bean>
</beans>

实体类:

package com.imooc.spring.ioc.entity;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/26 22:11
 * @Version 1.0
 */
public class Apple {
    private String title;
    private String color;
    private String origin;

    public Apple() {
    }

    public Apple(String title, String color, String origin) {
        this.title = title;
        this.color = color;
        this.origin = origin;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }
}

启动类:

package com.imooc.spring.ioc;

import com.imooc.spring.ioc.context.ApplicationContext;
import com.imooc.spring.ioc.context.ClassPathXmlApplicationContext;
import com.imooc.spring.ioc.entity.Apple;

/**
 * todo {类简要说明}
 *
 * @Author wangw
 * @Date 2022/11/26 22:27
 * @Version 1.0
 */
public class Application {
    public static void main(String[] args) {
        ApplicationContext context =new ClassPathXmlApplicationContext();
        Apple apple = (Apple) context.getBean("sweetApple");
        System.out.println(apple);

    }
}

至此实现效果如下,可以看出其实Spring IoC容器就是通过反射实现的
在这里插入图片描述


http://www.jnnr.cn/a/154112.html

相关文章

常见的数据结构基本介绍

文章目录常见的数据结构介绍栈和队列的介绍数组数据结构链表数据结构二叉树和二叉查找树平衡二叉树红黑树结构常见的数据结构介绍 数据结构是计算机底层存储、组织数据的方式。是指数据相互之间是以什么方式排列在一起的。 通常情况下&#xff0c;精心选择的数据结构可以带来更…

Leetcode刷题Day5休息 Day6----------哈希表

Leetcode刷题Day5休息 & Day6----------哈希表 1. 哈希表理论基础 数组、Set、Map 如果数据量小------------数组 如果数据量大------------Set 如果有Key、value------------Map 文章讲解&#xff1a;https://programmercarl.com/%E5%93%88%E5%B8%8C%E8%A1%A8%E7%90%86…

SpringBoot SpringBoot 原理篇 2 自定义starter 2.1 记录系统访客独立IP访问次数案例介绍

SpringBoot 【黑马程序员SpringBoot2全套视频教程&#xff0c;springboot零基础到项目实战&#xff08;spring boot2完整版&#xff09;】 SpringBoot 原理篇 文章目录SpringBootSpringBoot 原理篇2 自定义starter2.1 记录系统访客独立IP访问次数案例介绍2.1.1 介绍2.1.2 需求…

idea,web开发中jsp页面中不提示控制层的请求地址

随着开发的进行&#xff0c;打开spring配置文件会有如下提示 同时工程管理里如下 删掉后&#xff0c;发现打开sping配置文件不告警了&#xff0c;可是jsp页面中也没有了地址的提示 这个提示没有了 正确的做法是删掉Spring Application Context 因为其他配置文件都导入App…

【小5聊】纯javascript实现图片放大镜效果

实现图片放大镜效果&#xff0c;其实就是一个比例放大的效果 以下通过纯javascript方式对图片进行等比例放大&#xff0c;等比倍数和出界判断可自行实现 文章后面会附上全部代码 放大镜效果 1、 放大镜组成 1&#xff09;目标图片&#xff0c;一般是小图 2&#xff09;鼠标移…

Linux学习

一、linux目录结构 /bin [常用] &#xff1a;是Binary的缩写&#xff0c;这个目录存放着最经常使用的命令/sbin&#xff1a;s就是super user的意思&#xff0c;这里存放的是系统管理员使用的系统管理程序/home [常用]&#xff1a;存放普通用户的主目录&#xff0c;在Linux中每…

MySQL 慢查询日志 使用方法浅析 日志定位与优化技巧

目录 前言 1、如何开启使用慢查询日志&#xff1f; 1.1 开启慢查询日志 1.2 设置慢查询阈值 1.3 确定慢查询日志的文件名和路径 1.3.1 查询MySQL数据目录 1.3.2 查询慢查询日志文件名 1.3.3 查询全局设置变量 1.3.4 查询单个变量命令 1.3.5 其他注意事项 2、如何定位并优…

第八章《Java高级语法》第12节:Lambda表达式

Lambda 表达式是 JDK8 的一个新特性,它可以定义大部分的匿名内部类,从而让程序员能写出更优雅的Java代码,尤其在集合的各种操作中可以极大地优化代码结构。 8.12.1 认识Lambda表达式 一个接口的实现类可以被定义为匿名类。经过大量实践,人们发现定义一个接口的匿名实现类…

痞子衡嵌入式:MCUXpresso IDE下高度灵活的FreeMarker链接文件模板机制

大家好&#xff0c;我是痞子衡&#xff0c;是正经搞技术的痞子。今天痞子衡给大家分享的是MCUXpresso IDE下高度灵活的FreeMarker链接文件模板机制。 痞子衡之前写过一篇文章 《MCUXpresso IDE下工程链接文件配置管理与自动生成机制》&#xff0c;这篇文章介绍了 MCUXpresso ID…

机器学习模型与backtrader框架整合

原创文章第116篇&#xff0c;专注“个人成长与财富自由、世界运作的逻辑&#xff0c; AI量化投资”。 北京疫情似乎还没有到拐点&#xff0c;但这三天结束后应该会到来。 今天重点说说&#xff0c;机器学习模型整合到我们的回测框架中&#xff0c;并与backtrader连接起来回测…

文献解读——基于深度学习的病毒宿主预测

文章目录背景介绍作者介绍文章概述流程数据准备输入数据处理深度神经网络结果背景介绍 人畜共患病病毒对人类和动物的健康产生巨大了威胁&#xff0c;例如近期爆发的寨卡病毒、埃博拉病毒以及冠状病毒。病毒起源的宿主信息对于有效控制和消灭传播是至关重要的&#xff0c;这是…

后台管理不可忽视,华为云会议最新支持管理员分权分域

如今&#xff0c;跨地域&#xff0c; 跨组织&#xff0c;需要随时随地接入的远程沟通协作变得愈加频繁&#xff0c;众多企业开始纷纷建设符合自身需求的智能会议室。在会议系统的众多能力中&#xff0c;后台管理&#xff0c;这项常常被C端用户忽略的能力&#xff0c;B端的企业却…

FreeCAD二次开发-基于PyQT对话框与FC交互的开发

版本 FreeCAD0.18.2+PyCharm Community 2020.3.3 演示效果 环境搭建步骤 1.先安装好FreeCAD和PyCharm 2.添加环境变量 点击确定,全部关掉。 3.测试变量是否生效(CMD打开控制台,输入python回车) 弹出如下,说明可以进入FreeCAD自带的python解释器 4.创建工作台Workbench(…

【线性表】—动态顺序表的增删查改实现

小菜坤日常上传gitee代码&#xff1a;https://gitee.com/qi-dunyan&#xff08;所有的原码都放在了我上面的gitee仓库里&#xff09; 数据结构知识点存放在专栏【数据结构】后续会持续更新 ❤❤❤ 个人简介&#xff1a;双一流非科班的一名小白&#xff0c;期待与各位大佬一起努…

scrapy的入门使用

目录 一、 安装scrapy 1.windonws/Mac安装命令&#xff1a; 2. 安装依赖包&#xff1a;pip install pypiwin32 二、 scrapy项目开发流程 1.创建项目:    2.生成一个爬虫: 3.提取数据: 4.保存数据: 三、 创建项目 四、创建爬虫 五、完善爬虫 5.2 定位元素以及提取…

C++智能指针之shared_ptr

C智能指针之shared_ptr前言一、Shared_ptr1.1 shared_ptr类的操作1.2 make_shared函数1.3 shared_ptr的拷贝赋值1.4 shared_ptr的自动销毁对象内存机制1.5 使用动态生存期的资源的类1.6 shared_ptr与new结合使用1.7 不要混合使用普通/智能指针1.8 不要使用 get 初始化另一个智能…

世界杯来了,让 Towhee 带你多语言「以文搜球」!

四年一度的世界杯已正式拉开战幕&#xff0c;各小组比赛正如火如荼地进行中。在这样一场球迷的盛宴中&#xff0c;不如让 Towhee 带你「以文搜球」&#xff0c;一览绿茵场上足球战将们的风采吧&#xff5e; 「以文搜球」是跨模态图文检索的一部分&#xff0c;如今最热门的跨模…

百行代码实现VLC简易视频播放器【详细环境配置过程+可执行源码注释完整】

文章目录❓什么是VLC&#x1f680;VLC 库的集成⭐VLC环境配置演示【win10系统vs2017win64】&#x1f34e;VLC 库的基本使用&#x1f382;视频播放器实现⭐自定义函数Unicode2Utf8讲解&#x1f3e0;总结❓什么是VLC VLC 是 Video Lan Client 的缩写&#xff0c;原先是几个法国的…

ES6解析赋值

ES6中新增了一种数据处理方式&#xff0c;可以将数组和对象的值提取出来对变量进行赋值&#xff0c;这个过程时将一个数据结构分解成更小的部分&#xff0c;称之为解析。 1.对象解析赋值: 在ES5中&#xff0c;要将一个对象的属性提取出来&#xff0c;需要经过一下几个过程。 …

springcloud22:sentinal的使用

sentinal对比&#xff08;分布式系统的流量防卫&#xff09; 监控保护微服务 Hystrix 需要自己去手工搭建监控平台&#xff0c;没有一套web界面可以进行细粒度化的配置&#xff0c;流控&#xff0c;速率控制&#xff0c;服务熔断&#xff0c;服务降级… 整合机制&#xff1a;se…
最新文章