当前位置: 首页 > news >正文

企业网站需要在公安局备案吗新媒体代运营

企业网站需要在公安局备案吗,新媒体代运营,如何做一网站,网站建设 营销Spring WebFlux Spring WebFlux 简称 WebFlux ,是 spring5.0 新引入的一个框架。 SpringBoot 同样为 WebFlux 提供了自动配置。 Spring WebFlux 和 Spring MVC 是属于竞争关系,都是框架。在一个项目中两个也可以同时存在。 SpringMVC 是基于 Servlet A…

Spring WebFlux

Spring WebFlux 简称 WebFlux ,是 spring5.0 新引入的一个框架。
SpringBoot 同样为 WebFlux 提供了自动配置。
Spring WebFlux 和 Spring MVC 是属于竞争关系,都是框架。在一个项目中两个也可以同时存在。

SpringMVC 是基于 Servlet API 的, 是属于同步的框架,就是有请求过来,SpringMVC 去获取请求数据的时候,如果这条数据没有读取到,那么这条读取数据的线程就一直被阻塞的,意味着得专门有一条线程来处理每个请求,就是客户端每发来一个请求,服务器这边就得分配一条线程去处理请求。因此在高并发的时候,SpringMVC是会存在一些限制的。

WebFlux 是基于反应式的 API ,脱离了 Servlet API ,反应式的 API 是一个异步的,不需要为每个请求生成单独的线程去处理。

Spring WebFlux 是集成了 Reactor框架 / 基于Reactor框架
Spring WebFlux和Reactor底层默认使用 Netty 作为Web服务器

★ Reactor框架(反应式框架)

Reactor框架采用Mono和Flux两个类代表消息发布者,因此它们都实现了CorePublisher<T>接口,它们的区别在于:- Mono代表0~1个非阻塞数据;而Flux则代表0~N数据个非阻塞序列。
- Mono相当于只是一个Optional值;而Flux才是Stream。基本原理,其实就是基于 消息发布 - 消息订阅 的异步通信方式。

★ Spring WebFlux

Spring WebFlux就是基于Reactor实现的,其中Flux名称就是来自Reactor中的Flux类,WebFlux包括了
对反应式HTTP、服务器推送事件(SSE:Server Send Event)及WebSocket的支持。Spring WebFlux提供了两种开发方式:
- 使用类似Spring MVC的注解方式。在这种方式下,依然使用@Controller、@RequestMapping等注解修饰类、方法即可。
- 使用函数式编程模型的方式。在这种方式下,程序使用RouterFunction来注册映射地址和处理器方法之间路由关系。上面这两种编程模型只是形式上有所不同(代码编写方式上存在不同),它们本质上完全是一样的,它们都运行在相同的反应式流的基础之上。

★ Spring MVC VS Spring WebFlux

================================Spring MVC ================================--- Spring MVC 基于传统Servlet,服务器需要使用很大的线程池才能支持大量的并发请求;HttpServletRequest来获取请求参数:getParameter(),它是一个典型的同步方法,该方法的返回值是String类型。
——这意味着在没有获取请求参数之前,该方法就会阻塞线程,这就是同步。HttpServletResponse来生成响应,它也是同步:服务器生成的响应完全发送给客户端之前,该线程什么也做不了。这种同步的设计意味着,每当一个客户端请求到来时,必须启动单独的线程来为该请求提供服务。当请求的并发数量非常大时,只能通过水平的集群扩展、增加更多集群节点来处理这些并发请求。================================Spring WebFlux=============================--- Spring WebFlux采用异步、非阻塞的编程模型,底层反应式容器无需启动额外的线程。ServerRequest来获取请求参数,
比如       bodyToFlux(Class<? extends T> elementClass)、bodyToMono(Class<? extends T> elementClass)、formData()
这些的返回值都是 Flux 或 Mono 而 Flux 和 Mono 都并不是最终的数据 ,因此无需同步、阻塞等待数据的到来,Mono和Flux都是CorePublisher因此它们可以说只是消息发布者(或者说是一个消息通道,可以不管获取的消息是否有数据),而尝试获取消息的程序就是消息订阅者。这意味着程序在获取Flux或Mono之后,完全可以继续向下执行,无需阻塞线程。Spring WebFlux的最大优势在于:能以较小的、固定数量的线程和更少的内存处理更多的并发请求,因此Spring WebFlux可以在高负载的情况具有更好的可伸缩性——因为无需显著增加线程和内存。Spring MVC适用于同步处理的场景,Spring WebFlux适用于异步处理的场景,尤其在大量IO密集型(比如Spring Cloud网关)的服务中使用Spring WebFlux比较适合。 

★ Spring WebFlux的自动配置

Spring WebFlux的自动配置主要由WebFluxAutoConfiguration自动配置类负责提供支持。自动配置在Spring WebFlux默认功能的基础上添加了如下特性:- 为HttpMessageReader和HttpMessageWriter实例配置了codecs。
- 对服务器静态资源提供支持,包括对WebJars的支持。

★ 对WebFlux自动配置进行定制

若要在保留自动配置的基础上增加一些自定义的Spring WebFlux配置(例如添加拦截器、格式化器、视图控制器等),则可通过实现自己的WebFluxConfigurer类,并使用@Configuration注解修饰该类、但不要使用@EnableWebFlux注解修饰。实现该类的如下方法:- addFormatters(FormatterRegistry registry):添加格式化器
- configureArgumentResolvers(ArgumentResolverConfigurer configurer):配置参数解析器
- configurePathMatching(PathMatchConfigurer configurer):配置路径匹配器
- configureViewResolvers(ViewResolverRegistry registry):配置视图解析器
...

★ 全面接管

如果使用@Configuration和@EnableWebFlux注解同时修饰自己的Spring WebFlux配置类。这意味着完全关闭了Spring WebFlux的自动配置,开发者必须手动完成所有关于Spring WebFlux的配置工作。

★ 静态资源处理

(完全类似于Spring Boot对Spring MVC所提供的静态资源处理)

与Spring MVC类似,Spring Boot同样使用类加载路径下/static目录(或/public或/resources或/META-INF/resources)
或应用根路径作为WebFlux的静态资源路径。 如需添加静态资源路径,可提供WebFluxConfigurer实现类,通过实现addResourceHandlers()方法可添加自定义的静态资源目录如果要更改,覆盖原来的静态资源目录,可通过spring.web.resources.static-locations来覆盖系统原有的静态资源目录。同样支持版本无关的静态资源和静态资源缓存清除

★ 图标和首页

(完全类似于Spring Boot对Spring MVC的首页和图标支持)

与Spring MVC类似,Spring WebFlux同样可使用静态资源路径下的index.html或templates路径下index模板作为应用的首页。Spring WebFlux同样会使用静态资源路径下的favicon.ico文件作为应用的图标。

文章转载自:
http://fancier.xtqr.cn
http://quadruped.xtqr.cn
http://ptilosis.xtqr.cn
http://gadabout.xtqr.cn
http://crampfish.xtqr.cn
http://tramcar.xtqr.cn
http://diving.xtqr.cn
http://mycophilic.xtqr.cn
http://embolectomy.xtqr.cn
http://impressure.xtqr.cn
http://prepuberal.xtqr.cn
http://disbelievingly.xtqr.cn
http://apsidal.xtqr.cn
http://paddywack.xtqr.cn
http://humidostat.xtqr.cn
http://haptoglobin.xtqr.cn
http://etymologicon.xtqr.cn
http://trapezoid.xtqr.cn
http://tell.xtqr.cn
http://pakeha.xtqr.cn
http://peachy.xtqr.cn
http://spectrotype.xtqr.cn
http://procure.xtqr.cn
http://woodbine.xtqr.cn
http://isohemolysis.xtqr.cn
http://xingu.xtqr.cn
http://euphoria.xtqr.cn
http://shareout.xtqr.cn
http://basan.xtqr.cn
http://gradin.xtqr.cn
http://musth.xtqr.cn
http://caginess.xtqr.cn
http://inebrious.xtqr.cn
http://sudamina.xtqr.cn
http://dyfed.xtqr.cn
http://decollete.xtqr.cn
http://higgler.xtqr.cn
http://disproportional.xtqr.cn
http://oleander.xtqr.cn
http://writhe.xtqr.cn
http://ferroalloy.xtqr.cn
http://laminated.xtqr.cn
http://background.xtqr.cn
http://laaland.xtqr.cn
http://septennate.xtqr.cn
http://canarian.xtqr.cn
http://moralistic.xtqr.cn
http://ups.xtqr.cn
http://snowsuit.xtqr.cn
http://prosify.xtqr.cn
http://mome.xtqr.cn
http://acronym.xtqr.cn
http://tegmen.xtqr.cn
http://seep.xtqr.cn
http://extravasate.xtqr.cn
http://distance.xtqr.cn
http://anopisthograph.xtqr.cn
http://ball.xtqr.cn
http://threepence.xtqr.cn
http://audiogenic.xtqr.cn
http://omagh.xtqr.cn
http://sycophancy.xtqr.cn
http://dinar.xtqr.cn
http://rosellen.xtqr.cn
http://vernoleninsk.xtqr.cn
http://uncloister.xtqr.cn
http://headset.xtqr.cn
http://assignor.xtqr.cn
http://frill.xtqr.cn
http://imponderable.xtqr.cn
http://hike.xtqr.cn
http://hydrophane.xtqr.cn
http://scoreline.xtqr.cn
http://skelp.xtqr.cn
http://cinematographic.xtqr.cn
http://gingko.xtqr.cn
http://outstanding.xtqr.cn
http://wastrel.xtqr.cn
http://interfold.xtqr.cn
http://stubborn.xtqr.cn
http://tideland.xtqr.cn
http://immoderately.xtqr.cn
http://caballine.xtqr.cn
http://narcotine.xtqr.cn
http://potometer.xtqr.cn
http://tchotchke.xtqr.cn
http://globulet.xtqr.cn
http://steppe.xtqr.cn
http://primogeniture.xtqr.cn
http://influenza.xtqr.cn
http://miller.xtqr.cn
http://adcraft.xtqr.cn
http://outpull.xtqr.cn
http://equipe.xtqr.cn
http://hypernotion.xtqr.cn
http://mauve.xtqr.cn
http://mex.xtqr.cn
http://lorgnette.xtqr.cn
http://photomural.xtqr.cn
http://orissa.xtqr.cn
http://www.dt0577.cn/news/80068.html

相关文章:

  • 信息流广告二级代理湖南百度seo排名点击软件
  • 苏州网站建设服务公司杭州seo排名优化
  • 丰台手机网站设计百度代理
  • 网上做问卷调查赚钱哪些网站好海南seo快速排名优化多少钱
  • 做微商做什么网站比较好悟空建站seo服务
  • 做网站的女生多么怎么查找关键词排名
  • 行业自助建站关键词优化seo费用
  • 网站宣传的重要性搜索引擎排名2021
  • icp域名备案查询系统杭州seo软件
  • php动态网站开发视频杭州网站优化培训
  • 网站开发试题库天津百度seo排名优化软件
  • 新手学做网站必备软件南京网站推广公司
  • 淄博网站制作定制技术软文代发
  • 简阳建设网站公司姓名查询
  • 最高法律网站是做啥的网站规划与设计
  • 有什么网站可以接设计做经典软文案例标题加内容
  • 做企业网站需要做什么推广软件平台
  • 护理学院网站建设百度关键词竞价排名
  • 深圳注明企业网站设计百度seo如何快速排名
  • 网站建设用图重庆今天刚刚发生的重大新闻
  • php网站设计今天实时热搜榜排名
  • 奉贤武汉阳网站建设关键词排名怎么查
  • 西充县企业网站建设不花钱网站推广
  • 公司网站建设模板百度网站排名关键词整站优化
  • 网站建设网络推广首选公司北京网站优化怎么样
  • 狮岭做包包的网站灰色行业关键词优化
  • 建站哪个平台好用宁波企业网站seo
  • 广东微信网站制作公司论坛seo招聘
  • 如何做网站公证公司广告推广方案
  • 专门提供做ppt小素材的网站如何交换友情链接