diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java index 4628023bb8a..5eae6665105 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java @@ -34,7 +34,7 @@ import org.springframework.core.annotation.AliasFor; * types, in arbitrary order (except for validation results, which need to * follow right after the corresponding command object, if desired): *
The following return types are supported for handler methods: *
As of 5.0 this executor is also used when a controller returns a reactive
+ * type that does streaming (e.g. "text/event-stream" or
+ * "application/stream+json") for the blocking writes to the
+ * {@link javax.servlet.ServletOutputStream}.
+ *
* @param taskExecutor the task executor instance to use by default
*/
public AsyncSupportConfigurer setTaskExecutor(AsyncTaskExecutor taskExecutor) {
diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc.xsd b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc.xsd
index e61eb3ef0fd..17549a10977 100644
--- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc.xsd
+++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc.xsd
@@ -231,9 +231,14 @@
>`, e.g. JSON array.
+
+Reactive libraries are detected and adapted to a Reactive Streams `Publisher`
+through Spring's pluggable `ReactiveAdapterRegistry` which by default supports
+Reactor 3, RxJava 2, and RxJava 1. Note that for RxJava 1 you will need to add
+https://github.com/ReactiveX/RxJavaReactiveStreams["io.reactivex:rxjava-reactive-streams"]
+to the classpath.
+
+A common assumption with reactive libraries is not block the processing thread.
+The `WebClient` with Reactor Netty for example is based on event-loop style
+handling using a small, fixed number of threads and those must not be blocked
+when writing to the `ServletResponseOutputStream`. Reactive libraries have
+operators for that but Spring MVC automatically writes asynchronously so you
+don't need to use that. The underlying `TaskExecutor` for this can be configured
+through the MVC Java config and the MVC namespace as described in the following
+section.
+
+[NOTE]
+====
+Unlike Spring MVC, Spring WebFlux is built on a non-blocking, reactive foundation
+and uses the Servlet 3.1 non-blocking I/O that's also based on event loop style
+processing and hence does not require a thread to absorb the effect of blocking.
+====
+
+
+
+
[[mvc-ann-async-configuration]]
==== Configuring Asynchronous Request Processing