Spring WebFlux 初探-响应式编程-021

   🤗 ApiHug × {Postman|Swagger|Api...} = 快↑ 准√ 省↓

  1. GitHub - apihug/apihug.com: All abou the Apihug   
  2. apihug.com: 有爱,有温度,有质量,有信任
  3. ApiHug - API design Copilot - IntelliJ IDEs Plugin | Marketplace

   The Next Generation API Development Platform - ApiHug

api-hug-contact

极简版初始化过程

  1. ReactiveWebServerFactoryConfiguration
  2. NettyReactiveWebServerFactory
  3. AnnotationConfigReactiveWebServerApplicationContext
    1. ReactiveWebServerApplicationContext

SpringApplicationAnnotationConfigReactiveWebServerApplicationContextNettyReactiveWebServerFactoryWebServerWebServerStartStopLifecycle封装 HttpHandler创建 HttpServeronRefresh 启动应用上下文createWebServer 创建Web服务new 创建封装WebServer到WebServerStartStopLifecycle控制start(启动)stop(关闭)SpringApplicationAnnotationConfigReactiveWebServerApplicationContextNettyReactiveWebServerFactoryWebServerWebServerStartStopLifecycle

#触发

  1. ReactiveWebServerApplicationContext#onRefresh
  2. ReactiveWebServerApplicationContext#createWebServer

private void createWebServer() {
		WebServerManager serverManager = this.serverManager;
		if (serverManager == null) {
			StartupStep createWebServer = this.getApplicationStartup().start("spring.boot.webserver.create");
			String webServerFactoryBeanName = getWebServerFactoryBeanName();
			ReactiveWebServerFactory webServerFactory = getWebServerFactory(webServerFactoryBeanName);
			createWebServer.tag("factory", webServerFactory.getClass().toString());
			boolean lazyInit = getBeanFactory().getBeanDefinition(webServerFactoryBeanName).isLazyInit();
			this.serverManager = new WebServerManager(this, webServerFactory, this::getHttpHandler, lazyInit); //【1】
			getBeanFactory().registerSingleton("webServerGracefulShutdown",
					new WebServerGracefulShutdownLifecycle(this.serverManager.getWebServer()));
			getBeanFactory().registerSingleton("webServerStartStop",
					new WebServerStartStopLifecycle(this.serverManager));  //【2】
			createWebServer.end();
		}
		initPropertySources();
}
  1. 【1】 创建一个 WebServerManager
  2. 【2】 封装到: WebServerStartStopLifecycle, 让外围流程控制启动顺序:

@Override
public int getPhase() {
  return Integer.MAX_VALUE - 1;
}

Spring Boot 配置元信息揭秘, 描述一般spring auto configuration 启动过程!

#WebFlux 自动配置

org.springframework.boot.autoconfigure.web.reactive.ReactiveMultipartAutoConfiguration=
org.springframework.boot.autoconfigure.web.reactive.ReactiveMultipartAutoConfiguration.ConditionalOnClass=org.springframework.http.codec.multipart.DefaultPartHttpMessageReader,org.springframework.web.reactive.config.WebFluxConfigurer
org.springframework.boot.autoconfigure.web.reactive.ReactiveMultipartAutoConfiguration.ConditionalOnWebApplication=REACTIVE


org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration=
org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration.AutoConfigureOrder=-2147483648
org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration.ConditionalOnClass=org.springframework.http.ReactiveHttpInputMessage
org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration.ConditionalOnWebApplication=REACTIVE


org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryConfiguration$EmbeddedNetty=
org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryConfiguration$EmbeddedNetty.ConditionalOnClass=reactor.netty.http.server.HttpServer


org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration=
org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.AutoConfigureAfter=org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration,org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,org.springframework.boot.autoconfigure.web.reactive.ReactiveMultipartAutoConfiguration,org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,org.springframework.boot.autoconfigure.web.reactive.WebSessionIdResolverAutoConfiguration

org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.AutoConfigureOrder=-2147483638
org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.ConditionalOnClass=org.springframework.web.reactive.config.WebFluxConfigurer
org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.ConditionalOnWebApplication=REACTIVE

#参考

  1. spring-framework | spring-webflux 源码open in new window
  2. Web on Reactive Stack 官方文档open in new window
  3. Spring-boot | web reactive 文档open in new window
  4. 第二学院 reactive 例子代码open in new window
  5. 第二学院 reactive 文档open in new window
  6. spring security reactive 安全open in new window
  7. Spring Cloud Gateway 最佳示范open in new window
  8. baeldung webfluxopen in new window
  9. baeldung websoketopen in new window
  10. baeldung reactive codeopen in new window


  11. rsocket

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

[HUBUCTF 2022 新生赛]ezsql

测试无结果 扫描目录,得到源码 找到注入点 思路:更新资料的时候可以同时更新所有密码 我们需要知道密码的字段名 爆库 nicknameasdf&age111,description(select database())#&descriptionaaa&token31ad6e5a2534a91ed634aca0b27c14a9 爆表…

外网ip地址怎么获取?快解析

大家都清楚互联网是通过ip地址通信的,ip地址又分内网ip和外网ip。内网ip只能在内网使用;而外网ip作为电脑唯一标识,可在公网使用。那么外网ip地址怎么获取呢? 外网ip是网络运营商分配给用户的。目前最常见的两种上网方式一个是拉…

Muse论文精读

Muse Abstract 我们介绍了Muse,一个文本到图像的Transformer模型,它实现了最先进的图像生成性能,同时比扩散或自回归模型更有效。Muse是在离散标记空间中的掩码建模任务上进行训练的:给定从预训练的大型语言模型(LLM)中提取的文本嵌入&…

【保姆级介绍下运维】

🌈个人主页: 程序员不想敲代码啊 🏆CSDN优质创作者,CSDN实力新星,CSDN博客专家 👍点赞⭐评论⭐收藏 🤝希望本文对您有所裨益,如有不足之处,欢迎在评论区提出指正,让我们共…

nginx反向代理使用(详细版)

1. 下载nginx,解压;(随便放在哪里) 2. 在nginx-1.26.0文件夹下创建web文件夹,继续在web文件夹下创建abcd.test.cn文件夹(文件夹的名字就叫abcd.test.cn); 3. 配置前端代理&#xff…

【现代C++】三路比较运算符

C20引入了三路比较运算符&#xff08;也称为太空船运算符&#xff0c;<>&#xff09;&#xff0c;它允许同时比较两个值&#xff0c;并返回它们的相对顺序。这个运算符简化了需要定义多个比较运算符&#xff08;如、!、<、<、>、>&#xff09;的类的代码&…

吞吐量 和 延时的关系

关于吞吐量/吞吐率、延时&#xff0c;你可以通过 Jmeter中的”聚合报告“和”用表格查看报告“来获取。 Throughput 越大&#xff0c;Latency 越差&#xff1a;因为请求过多&#xff0c;系统繁忙导致响应速度降低。Latency 的值越小说明能支持的 Throughput 越高&#xff1a;L…

全像宇宙投影第三部时间与空间(全文)下载

当这个人向空中凝视时&#xff0c;他所在的房间渐渐变得透明而朦胧&#xff0c;空中渐渐浮现一个久远前景像。突然他觉得自己在皇宫中庭内&#xff0c;他面前站著一位年轻女士非常美丽&#xff0c;有著橄榄色的皮肤。他可以见到她的颈项、手腕、脚踝上都挂著金饰&#xff0c;还…

如何使用AzurEnum快速枚举Microsoft Entra ID(Azure AD)

AzurEnum是一款针对Azure的安全工具&#xff0c;在该工具的帮助下&#xff0c;广大研究人员可以轻松快速地枚举Microsoft Entra ID&#xff08;Azure AD&#xff09;。 该工具基于纯Python 3开发&#xff0c;可以在Windows和Linux系统上运行&#xff0c;但考虑到性能和稳定性&a…

windows下mysql5.6下载安装(多实例安装)

目录 1、下载 2、安装步骤 3、mysql多实例安装 1、下载 http://dev.mysql.com/downloads/windows/installer/5.6.html 2、安装步骤 我们采用自定义安装模式&#xff1a;选择32位或64位 默认即可&#xff1a; 说明&#xff0c;如果没有该页面就上一步&#xff0c;选择高级选…

类人速度超快语音响应!OpenAI推出新旗舰模型GPT-4o,图文音频手机AI搞定

内容概述 虽然没有带来备受期待的人工智能&#xff08;AI&#xff09;搜索引擎&#xff0c;但OpenAI在主打产品AI模型上花了更多心思&#xff0c;拓展多模态功能&#xff0c;让用户可以免费玩转文字、图片和语音输入。 美东时间5月13日周一&#xff0c;OpenAI首席技术官Mira …

三星将采用铁电材料实现1000层3D NAND

在2022年的技术日上&#xff0c;三星公布了一项宏伟目标&#xff0c;即到2030年推出层数超过1000层的先进NAND芯片。据Wccftech报道&#xff0c;这家韩国存储巨头似乎正逐步接近这一目标&#xff0c;计划在NAND芯片制造中应用新型“铁电”材料。 最近美国火奴鲁鲁举行的VLSI技术…

学习Uni-app开发小程序Day11

今天是学习的第11天&#xff0c;今天学习了组件的生命周期&#xff0c;这里的生命周期&#xff0c;主要是学习uni-app的组件生命周期&#xff0c;虽然vue也有&#xff0c;但主要还是学习uni-app的。1. onLoad 监听页面加载&#xff0c;该钩子被调用时&#xff0c;响应式数据、计…

2024 年第一季度全球互联网中断事件

2024 年第一季度伊始&#xff0c;互联网发生了多起中断事件。陆地和海底电缆的损坏在多个地方造成了问题&#xff0c;而与持续中地缘政治冲突相关的军事行动影响了其他地区的连接。 几个非洲国家以及巴基斯坦的政府下令关闭互联网&#xff0c;主要针对移动网络连接。 被称为Ano…

Taylor Francis科技期刊数据库文献去哪里获取

一、Taylor & Francis科技期刊数据库简介&#xff1a; Taylor & Francis 科技期刊数据库&#xff08;T&F ST Library&#xff09;提供超过520种经专家评审的高质量科学与技术类期刊, 其中超过85%的期刊被Web of Science收录&#xff0c;内容最早至1997年。该科技期…

011.理解事件(events)和流(streams)

在软件系统中&#xff0c;事件是一种用于指示发生了什么事情的消息。该事件可能代表一个技术事件——例如&#xff0c;在GUI应用程序中&#xff0c;您可能会在按下的每个键或每次鼠标移动上看到事件。该事件还可以表示业务发生&#xff0c;例如在金融系统中完成的货币交易。 事…

【启程Golang之旅】环境设置、工具安装与代码实践

欢迎来到Golang的世界&#xff01;在当今快节奏的软件开发领域&#xff0c;选择一种高效、简洁的编程语言至关重要。而在这方面&#xff0c;Golang&#xff08;又称Go&#xff09;无疑是一个备受瞩目的选择。在本文中&#xff0c;带领您探索Golang的世界&#xff0c;一步步地了…

LearnOpenGL(十七)之混合

一、丢弃片段 有些图片并不需要半透明&#xff0c;只需要根据纹理颜色值&#xff0c;显示一部分&#xff08;alpha值为1.0&#xff09;&#xff0c;或者不显示一部分&#xff08;alpha值为0.0&#xff09;&#xff0c;没有中间情况。我们需要丢弃(Discard)显示纹理中透明部分的…

嵌入式学习71-(内核定时器和传感器)

缺少内核配置文件.config 解决&#xff1a;cp config_mini2440_td35 .config 1.make 编译一下 生成timer.ko文件 2. cp timer.ko ~/nfs/rootfs 为什么要拷贝到rootfs中&#xff0c;这是挂载的根文件系统 &#xff0c;使用nfs作为根文件系统 实际上内核启动的时候并不知道…

【问题实操】银河高级服务器操作系统实例分享,网卡drop问题分析

1.服务器环境以及配置 系统环境 物理机/虚拟机/云/容器 物理机 网络环境 外网/私有网络/无网络 私有网络 硬件环境 机型 华鲲振宇 TG225B1 处理器 kunpeng 920 内存 1024GB 主板型号 TG225B1 HZKY 整机类型/架构 aarch64 固件版本 6.57 软件环境 具体操作系…