Skip to content

Commit 71ccf3c

Browse files
committed
Polish
1 parent 13c9592 commit 71ccf3c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/docs/asciidoc/web/webflux.adoc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
== Introduction
66
The original web framework included in the Spring Framework, Spring Web MVC, was purpose
77
built for the Servlet API and Servlet containers. The reactive stack, web framework,
8-
Spring WebFlux, was added later in version 5.0. It is built on a
9-
http://www.reactive-streams.org/[Reactive Streams] API and runs on non-blocking
10-
servers such as Netty, Undertow, and Servlet 3.1+ containers.
8+
Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports
9+
http://www.reactive-streams.org/[Reactive Streams] back pressure, and runs on servers such as
10+
Netty, Undertow, and Servlet 3.1+ containers.
1111

1212
Both web frameworks mirror the names of their source modules
1313
https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc[spring-webmvc] and
@@ -26,11 +26,11 @@ a `WebTestClient` for testing web endpoints, and WebSocket support.
2626

2727
Part of the answer is the need for a non-blocking web stack to handle concurrency with a
2828
small number of threads and scale with less hardware resources. Servlet 3.1 did provide
29-
an API for non-blocking I/O. However the use of that leads away from using the rest of the
30-
Servlet API which remains synchronous -- `Filter`, `Servlet`, and blocking -- `getParameter`,
31-
`getPart`. On the positive side a new common API foundation makes it possible to support any
32-
server and that is important because of runtimes such as Netty that are well established in
33-
the async, non-blocking space.
29+
an API for non-blocking I/O. However, using it leads away from the rest of the Servlet API
30+
where contracts are synchronous (`Filter`, `Servlet`) or blocking (`getParameter`,
31+
`getPart`). This was the motivation for a new common API to serve as a foundation across
32+
any non-blocking runtime. That is important because of servers such as Netty that are well
33+
established in the async, non-blocking space.
3434

3535
The other part of the answer is functional programming. Much like the addition of annotations
3636
in Java 5 created opportunities -- e.g. annotated REST controllers or unit tests, the addition
@@ -92,8 +92,8 @@ https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html
9292
to work on data sequences of 0..1 and 0..N through a rich set of operators aligned with the
9393
ReactiveX http://reactivex.io/documentation/operators.html[vocabulary of operators].
9494
Reactor is a Reactive Streams library and therefore all of its operators support non-blocking back pressure.
95-
Reactor has a strong focus on server-side Java.
96-
It is developed in close collaboration with and feedback from Spring projects.
95+
Reactor has a strong focus on server-side Java. It is developed in close collaboration
96+
with Spring.
9797

9898
WebFlux requires Reactor as a core dependency but it is interoperable with other reactive
9999
libraries via Reactive Streams. As a general rule WebFlux APIs accept a plain `Publisher`
@@ -150,10 +150,10 @@ for the same annotation-based programming model in both frameworks makes it easi
150150
re-use knowledge while also selecting the right tool for the right job.
151151

152152
A simple way to evaluate an application is to check its dependencies. If you have blocking
153-
persistence APIs, or networking APIs to use, then Spring MVC is the best choice for common
154-
architectures at least. It is technically feasible with both Reactor and RxJava to perform
155-
blocking calls on a separate thread but you wouldn't be making the most of a non-blocking
156-
web stack.
153+
persistence APIs (JPA, JDBC), or networking APIs to use, then Spring MVC is the best choice
154+
for common architectures at least. It is technically feasible with both Reactor and
155+
RxJava to perform blocking calls on a separate thread but you wouldn't be making the
156+
most of a non-blocking web stack.
157157

158158
If you have a Spring MVC application with calls to remote services, try the reactive `WebClient`.
159159
You can return reactive types (Reactor, RxJava, <<webflux-reactive-libraries,or other>>)

0 commit comments

Comments
 (0)