Structural Fixes

This commit is contained in:
Rob Winch 2023-04-20 09:51:32 -05:00 committed by rstoyanchev
parent 3774e9be7a
commit 7b0ba0188f
21 changed files with 103 additions and 142 deletions

View File

@ -158,31 +158,31 @@
**** xref:testing/spring-mvc-test-framework/server-htmlunit/geb.adoc[]
** xref:testing/spring-mvc-test-client.adoc[]
** xref:testing/appendix.adoc[]
** xref:testing/annotations.adoc[]
*** xref:testing/annotations/integration-standard.adoc[]
*** xref:testing/annotations/integration-spring.adoc[]
**** xref:testing/annotations/integration-spring/annotation-bootstrapwith.adoc[]
**** xref:testing/annotations/integration-spring/annotation-contextconfiguration.adoc[]
**** xref:testing/annotations/integration-spring/annotation-webappconfiguration.adoc[]
**** xref:testing/annotations/integration-spring/annotation-contexthierarchy.adoc[]
**** xref:testing/annotations/integration-spring/annotation-activeprofiles.adoc[]
**** xref:testing/annotations/integration-spring/annotation-testpropertysource.adoc[]
**** xref:testing/annotations/integration-spring/annotation-dynamicpropertysource.adoc[]
**** xref:testing/annotations/integration-spring/annotation-dirtiescontext.adoc[]
**** xref:testing/annotations/integration-spring/annotation-testexecutionlisteners.adoc[]
**** xref:testing/annotations/integration-spring/annotation-recordapplicationevents.adoc[]
**** xref:testing/annotations/integration-spring/annotation-commit.adoc[]
**** xref:testing/annotations/integration-spring/annotation-rollback.adoc[]
**** xref:testing/annotations/integration-spring/annotation-beforetransaction.adoc[]
**** xref:testing/annotations/integration-spring/annotation-aftertransaction.adoc[]
**** xref:testing/annotations/integration-spring/annotation-sql.adoc[]
**** xref:testing/annotations/integration-spring/annotation-sqlconfig.adoc[]
**** xref:testing/annotations/integration-spring/annotation-sqlmergemode.adoc[]
**** xref:testing/annotations/integration-spring/annotation-sqlgroup.adoc[]
*** xref:testing/annotations/integration-junit4.adoc[]
*** xref:testing/annotations/integration-junit-jupiter.adoc[]
*** xref:testing/annotations/integration-meta.adoc[]
** xref:testing/resources.adoc[]
*** xref:testing/annotations.adoc[]
**** xref:testing/annotations/integration-standard.adoc[]
**** xref:testing/annotations/integration-spring.adoc[]
***** xref:testing/annotations/integration-spring/annotation-bootstrapwith.adoc[]
***** xref:testing/annotations/integration-spring/annotation-contextconfiguration.adoc[]
***** xref:testing/annotations/integration-spring/annotation-webappconfiguration.adoc[]
***** xref:testing/annotations/integration-spring/annotation-contexthierarchy.adoc[]
***** xref:testing/annotations/integration-spring/annotation-activeprofiles.adoc[]
***** xref:testing/annotations/integration-spring/annotation-testpropertysource.adoc[]
***** xref:testing/annotations/integration-spring/annotation-dynamicpropertysource.adoc[]
***** xref:testing/annotations/integration-spring/annotation-dirtiescontext.adoc[]
***** xref:testing/annotations/integration-spring/annotation-testexecutionlisteners.adoc[]
***** xref:testing/annotations/integration-spring/annotation-recordapplicationevents.adoc[]
***** xref:testing/annotations/integration-spring/annotation-commit.adoc[]
***** xref:testing/annotations/integration-spring/annotation-rollback.adoc[]
***** xref:testing/annotations/integration-spring/annotation-beforetransaction.adoc[]
***** xref:testing/annotations/integration-spring/annotation-aftertransaction.adoc[]
***** xref:testing/annotations/integration-spring/annotation-sql.adoc[]
***** xref:testing/annotations/integration-spring/annotation-sqlconfig.adoc[]
***** xref:testing/annotations/integration-spring/annotation-sqlmergemode.adoc[]
***** xref:testing/annotations/integration-spring/annotation-sqlgroup.adoc[]
**** xref:testing/annotations/integration-junit4.adoc[]
**** xref:testing/annotations/integration-junit-jupiter.adoc[]
**** xref:testing/annotations/integration-meta.adoc[]
*** xref:testing/resources.adoc[]
* xref:data-access.adoc[]
** xref:data-access/transaction.adoc[]
*** xref:data-access/transaction/motivation.adoc[]
@ -268,11 +268,24 @@
**** xref:web/webmvc/mvc-controller/ann-initbinder.adoc[]
**** xref:web/webmvc/mvc-controller/ann-exceptionhandler.adoc[]
**** xref:web/webmvc/mvc-controller/ann-advice.adoc[]
*** xref:web/webmvc-functional.adoc[]
*** xref:web/webmvc/mvc-uri-building.adoc[]
*** xref:web/webmvc/mvc-ann-async.adoc[]
*** xref:web/webmvc-cors.adoc[]
*** xref:web/webmvc/mvc-ann-rest-exceptions.adoc[]
*** xref:web/webmvc/mvc-security.adoc[]
*** xref:web/webmvc/mvc-caching.adoc[]
*** xref:web/webmvc-view.adoc[]
**** xref:web/webmvc-view/mvc-thymeleaf.adoc[]
**** xref:web/webmvc-view/mvc-freemarker.adoc[]
**** xref:web/webmvc-view/mvc-groovymarkup.adoc[]
**** xref:web/webmvc-view/mvc-script.adoc[]
**** xref:web/webmvc-view/mvc-jsp.adoc[]
**** xref:web/webmvc-view/mvc-feeds.adoc[]
**** xref:web/webmvc-view/mvc-document.adoc[]
**** xref:web/webmvc-view/mvc-jackson.adoc[]
**** xref:web/webmvc-view/mvc-xml-marshalling.adoc[]
**** xref:web/webmvc-view/mvc-xslt.adoc[]
*** xref:web/webmvc/mvc-config.adoc[]
**** xref:web/webmvc/mvc-config/enable.adoc[]
**** xref:web/webmvc/mvc-config/customize.adoc[]
@ -289,21 +302,6 @@
**** xref:web/webmvc/mvc-config/advanced-java.adoc[]
**** xref:web/webmvc/mvc-config/advanced-xml.adoc[]
*** xref:web/webmvc/mvc-http2.adoc[]
** xref:web/web-data-binding-model-design.adoc[]
** xref:web/webmvc-functional.adoc[]
** xref:web/web-uris.adoc[]
** xref:web/webmvc-cors.adoc[]
** xref:web/webmvc-view.adoc[]
*** xref:web/webmvc-view/mvc-thymeleaf.adoc[]
*** xref:web/webmvc-view/mvc-freemarker.adoc[]
*** xref:web/webmvc-view/mvc-groovymarkup.adoc[]
*** xref:web/webmvc-view/mvc-script.adoc[]
*** xref:web/webmvc-view/mvc-jsp.adoc[]
*** xref:web/webmvc-view/mvc-feeds.adoc[]
*** xref:web/webmvc-view/mvc-document.adoc[]
*** xref:web/webmvc-view/mvc-jackson.adoc[]
*** xref:web/webmvc-view/mvc-xml-marshalling.adoc[]
*** xref:web/webmvc-view/mvc-xslt.adoc[]
** xref:web/webmvc-client.adoc[]
** xref:web/webmvc-test.adoc[]
** xref:web/websocket.adoc[]
@ -333,7 +331,6 @@
**** xref:web/websocket/stomp/configuration-performance.adoc[]
**** xref:web/websocket/stomp/stats.adoc[]
**** xref:web/websocket/stomp/testing.adoc[]
** xref:web/websocket-intro.adoc[]
** xref:web/integration.adoc[]
* xref:web-reactive.adoc[]
** xref:web/webflux.adoc[]
@ -365,15 +362,15 @@
**** xref:web/webflux/controller/ann-initbinder.adoc[]
**** xref:web/webflux/controller/ann-exceptions.adoc[]
**** xref:web/webflux/controller/ann-advice.adoc[]
*** xref:web/webflux-functional.adoc[]
*** xref:web/webflux/uri-building.adoc[]
*** xref:web/webflux-cors.adoc[]
*** xref:web/webflux/ann-rest-exceptions.adoc[]
*** xref:web/webflux/security.adoc[]
*** xref:web/webflux/caching.adoc[]
*** xref:web/webflux-view.adoc[]
*** xref:web/webflux/config.adoc[]
*** xref:web/webflux/http2.adoc[]
** xref:web/webflux-functional.adoc[]
** xref:web/webflux-cors.adoc[]
** xref:web/webflux-view.adoc[]
** xref:web/webflux-webclient.adoc[]
*** xref:web/webflux-webclient/client-builder.adoc[]
*** xref:web/webflux-webclient/client-retrieve.adoc[]
@ -384,8 +381,11 @@
*** xref:web/webflux-webclient/client-context.adoc[]
*** xref:web/webflux-webclient/client-synchronous.adoc[]
*** xref:web/webflux-webclient/client-testing.adoc[]
** xref:web/webflux-http-interface-client.adoc[]
** xref:web/webflux-websocket.adoc[]
* xref:rsocket.adoc[]
** xref:web/webflux-test.adoc[]
** xref:rsocket.adoc[]
** xref:web/webflux-reactive-libraries.adoc[]
* xref:integration.adoc[]
** xref:integration/rest-clients.adoc[]
** xref:integration/jms.adoc[]
@ -431,3 +431,4 @@
** xref:languages/groovy.adoc[]
** xref:languages/dynamic.adoc[]
* xref:appendix.adoc[]
* https://github.com/spring-projects/spring-framework/wiki[Wiki]

View File

@ -558,6 +558,3 @@ Therefore, it has limited namespace support. As a result, it is rather unsuitabl
within Web Services.
include:../:data-access/appendix.adoc[leveloffset=+1]

View File

@ -39,7 +39,7 @@ Version `1.4.0` and above are supported.
[[how-reactive-translates-to-coroutines?]]
[[how-reactive-translates-to-coroutines]]
== How Reactive translates to Coroutines?
For return values, the translation from Reactive to Coroutines APIs is the following:

View File

@ -9,65 +9,3 @@ the reactive xref:web/webflux-webclient.adoc[`WebClient`], support for xref:web-
and xref:web-reactive.adoc#webflux-reactive-libraries[reactive libraries]. For Servlet-stack web applications,
see xref:web.adoc[Web on Servlet Stack].
[[webflux-http-interface-client]]
== HTTP Interface Client
The Spring Frameworks lets you define an HTTP service as a Java interface with HTTP
exchange methods. You can then generate a proxy that implements this interface and
performs the exchanges. This helps to simplify HTTP remote access and provides additional
flexibility for to choose an API style such as synchronous or reactive.
See xref:integration/rest-clients.adoc#rest-http-interface[REST Endpoints] for details.
[[webflux-test]]
== Testing
[.small]#xref:web/webmvc-test.adoc[Same in Spring MVC]#
The `spring-test` module provides mock implementations of `ServerHttpRequest`,
`ServerHttpResponse`, and `ServerWebExchange`.
See xref:testing/unit.adoc#mock-objects-web-reactive[Spring Web Reactive] for a
discussion of mock objects.
xref:testing/webtestclient.adoc[`WebTestClient`] builds on these mock request and
response objects to provide support for testing WebFlux applications without an HTTP
server. You can use the `WebTestClient` for end-to-end integration tests, too.
[[webflux-reactive-libraries]]
== Reactive Libraries
`spring-webflux` depends on `reactor-core` and uses it internally to compose asynchronous
logic and to provide Reactive Streams support. Generally, WebFlux APIs return `Flux` or
`Mono` (since those are used internally) and leniently accept any Reactive Streams
`Publisher` implementation as input. The use of `Flux` versus `Mono` is important, because
it helps to express cardinality -- for example, whether a single or multiple asynchronous
values are expected, and that can be essential for making decisions (for example, when
encoding or decoding HTTP messages).
For annotated controllers, WebFlux transparently adapts to the reactive library chosen by
the application. This is done with the help of the
{api-spring-framework}/core/ReactiveAdapterRegistry.html[`ReactiveAdapterRegistry`], which
provides pluggable support for reactive library and other asynchronous types. The registry
has built-in support for RxJava 3, Kotlin coroutines and SmallRye Mutiny, but you can
register others, too.
For functional APIs (such as <<webflux-fn>>, the `WebClient`, and others), the general rules
for WebFlux APIs apply -- `Flux` and `Mono` as return values and a Reactive Streams
`Publisher` as input. When a `Publisher`, whether custom or from another reactive library,
is provided, it can be treated only as a stream with unknown semantics (0..N). If, however,
the semantics are known, you can wrap it with `Flux` or `Mono.from(Publisher)` instead
of passing the raw `Publisher`.
For example, given a `Publisher` that is not a `Mono`, the Jackson JSON message writer
expects multiple values. If the media type implies an infinite stream (for example,
`application/json+stream`), values are written and flushed individually. Otherwise,
values are buffered into a list and rendered as a JSON array.

View File

@ -0,0 +1,10 @@
[[webflux-http-interface-client]]
= HTTP Interface Client
The Spring Frameworks lets you define an HTTP service as a Java interface with HTTP
exchange methods. You can then generate a proxy that implements this interface and
performs the exchanges. This helps to simplify HTTP remote access and provides additional
flexibility for to choose an API style such as synchronous or reactive.
See xref:integration/rest-clients.adoc#rest-http-interface[REST Endpoints] for details.

View File

@ -0,0 +1,29 @@
[[webflux-reactive-libraries]]
= Reactive Libraries
`spring-webflux` depends on `reactor-core` and uses it internally to compose asynchronous
logic and to provide Reactive Streams support. Generally, WebFlux APIs return `Flux` or
`Mono` (since those are used internally) and leniently accept any Reactive Streams
`Publisher` implementation as input. The use of `Flux` versus `Mono` is important, because
it helps to express cardinality -- for example, whether a single or multiple asynchronous
values are expected, and that can be essential for making decisions (for example, when
encoding or decoding HTTP messages).
For annotated controllers, WebFlux transparently adapts to the reactive library chosen by
the application. This is done with the help of the
{api-spring-framework}/core/ReactiveAdapterRegistry.html[`ReactiveAdapterRegistry`], which
provides pluggable support for reactive library and other asynchronous types. The registry
has built-in support for RxJava 3, Kotlin coroutines and SmallRye Mutiny, but you can
register others, too.
For functional APIs (such as <<webflux-fn>>, the `WebClient`, and others), the general rules
for WebFlux APIs apply -- `Flux` and `Mono` as return values and a Reactive Streams
`Publisher` as input. When a `Publisher`, whether custom or from another reactive library,
is provided, it can be treated only as a stream with unknown semantics (0..N). If, however,
the semantics are known, you can wrap it with `Flux` or `Mono.from(Publisher)` instead
of passing the raw `Publisher`.
For example, given a `Publisher` that is not a `Mono`, the Jackson JSON message writer
expects multiple values. If the media type implies an infinite stream (for example,
`application/json+stream`), values are written and flushed individually. Otherwise,
values are buffered into a list and rendered as a JSON array.

View File

@ -0,0 +1,12 @@
[[webflux-test]]
= Testing
[.small]#xref:web/webmvc-test.adoc[Same in Spring MVC]#
The `spring-test` module provides mock implementations of `ServerHttpRequest`,
`ServerHttpResponse`, and `ServerWebExchange`.
See xref:testing/unit.adoc#mock-objects-web-reactive[Spring Web Reactive] for a
discussion of mock objects.
xref:testing/webtestclient.adoc[`WebTestClient`] builds on these mock request and
response objects to provide support for testing WebFlux applications without an HTTP
server. You can use the `WebTestClient` for end-to-end integration tests, too.

View File

@ -5,9 +5,7 @@
This part of the reference documentation covers support for reactive-stack WebSocket
messaging.
include::partial$web/websocket-intro.adoc[leveloffset=+1]
[[webflux-websocket-server]]
== WebSocket API

View File

@ -171,7 +171,3 @@ to 412 (PRECONDITION_FAILED) to prevent concurrent modification.
You should serve static resources with a `Cache-Control` and conditional response headers
for optimal performance. See the section on configuring xref:web/webflux/config.adoc#webflux-config-static-resources[Static Resources].
include:../:webflux-view.adoc[leveloffset=+1]

View File

@ -62,8 +62,3 @@ performance if used extensively. See the
{api-spring-framework}/web/bind/annotation/ControllerAdvice.html[`@ControllerAdvice`]
javadoc for more details.
include:../../:webflux-functional.adoc[leveloffset=+1]

View File

@ -102,6 +102,4 @@ controller-specific `Formatter` instances, as the following example shows:
== Model Design
[.small]#xref:web/webmvc/mvc-controller/ann-initbinder.adoc#mvc-ann-initbinder-model-design[See equivalent in the Servlet stack]#
include:../../:web-data-binding-model-design.adoc[]

View File

@ -6,8 +6,6 @@
This section describes various options available in the Spring Framework to prepare URIs.
include:../:web-uris.adoc[leveloffset=+2]
include:../:webflux-cors.adoc[leveloffset=+1]
include::partial$web/web-uris.adoc[leveloffset=+1]

View File

@ -484,7 +484,3 @@ Note that you can also set the default timeout value on a `DeferredResult`,
a `ResponseBodyEmitter`, and an `SseEmitter`. For a `Callable`, you can use
`WebAsyncTask` to provide a timeout value.
include:../:webmvc-cors.adoc[leveloffset=+1]

View File

@ -187,8 +187,3 @@ for optimal performance. See the section on configuring xref:web/webmvc/mvc-conf
You can use the `ShallowEtagHeaderFilter` to add "`shallow`" `eTag` values that are computed from the
response content and, thus, save bandwidth but not CPU time. See xref:web/webmvc/filters.adoc#filters-shallow-etag[Shallow ETag].
include:../:webmvc-view.adoc[leveloffset=+1]

View File

@ -59,7 +59,6 @@ performance if used extensively. See the
{api-spring-framework}/web/bind/annotation/ControllerAdvice.html[`@ControllerAdvice`]
javadoc for more details.
include:../../:webmvc-functional.adoc[leveloffset=+1]

View File

@ -97,6 +97,6 @@ controller-specific `Formatter` implementations, as the following example shows:
== Model Design
[.small]#xref:web/webflux/controller/ann-initbinder.adoc#webflux-ann-initbinder-model-design[See equivalent in the Reactive stack]#
include:../../:web-data-binding-model-design.adoc[]
include::partial$web/web-data-binding-model-design.adoc[]

View File

@ -5,7 +5,7 @@
This section describes various options available in the Spring Framework to work with URI's.
include:../:web-uris.adoc[leveloffset=+2]
include::partial$web/web-uris.adoc[leveloffset=+1]

View File

@ -7,7 +7,6 @@ This part of the reference documentation covers support for Servlet stack, WebSo
messaging that includes raw WebSocket interactions, WebSocket emulation through SockJS, and
publish-subscribe messaging through STOMP as a sub-protocol over WebSocket.
include::partial$web/websocket-intro.adoc[leveloffset=+1]