Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes and improvements to the reference documentation #29694

Closed
3 changes: 1 addition & 2 deletions framework-docs/src/docs/asciidoc/core/core-aop.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2920,8 +2920,7 @@ AspectJ. You also need to use AspectJ if you wish to advise join points other th
simple method executions (for example, field get or set join points and so on).

When you use AspectJ, you have the choice of the AspectJ language syntax (also known as
the "`code style`") or the @AspectJ annotation style. Clearly, if you do not use Java
5+, the choice has been made for you: Use the code style. If aspects play a large
the "`code style`") or the @AspectJ annotation style. If aspects play a large
role in your design, and you are able to use the https://www.eclipse.org/ajdt/[AspectJ
Development Tools (AJDT)] plugin for Eclipse, the AspectJ language syntax is the
preferred option. It is cleaner and simpler because the language was purposefully
Expand Down
6 changes: 3 additions & 3 deletions framework-docs/src/docs/asciidoc/data-access.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Typically, you need an application server's JTA capability only if your applicat
to handle transactions across multiple resources, which is not a requirement for many
applications. Many high-end applications use a single, highly scalable database (such as
Oracle RAC) instead. Stand-alone transaction managers (such as
https://www.atomikos.com/[Atomikos Transactions] and https://jotm.ow2.org/[JOTM])
https://www.atomikos.com/[Atomikos Transactions])
are other options. Of course, you may need other application server capabilities, such as
Java Message Service (JMS) and Jakarta EE Connector Architecture (JCA).

Expand Down Expand Up @@ -6850,7 +6850,7 @@ Without specifying further mapping details, queries return tabular results
as `Map` whose keys are case-insensitive column names that map to their column value.

You can take control over result mapping by supplying a `Function<Row, T>` that gets
called for each `Row` so it can can return arbitrary values (singular values,
called for each `Row` so it can return arbitrary values (singular values,
collections and maps, and objects).

The following example extracts the `name` column and emits its value:
Expand Down Expand Up @@ -7212,7 +7212,7 @@ responsibility of the administrator who sets up the `ConnectionFactory`. You
most likely fill both roles as you develop and test code, but you do not
necessarily have to know how the production data source is configured.

When you use Spring's R2DBC layer, you can can configure your own with a
When you use Spring's R2DBC layer, you can configure your own with a
connection pool implementation provided by a third party. A popular
implementation is R2DBC Pool (`r2dbc-pool`). Implementations in the Spring
distribution are meant only for testing purposes and do not provide pooling.
Expand Down
3 changes: 2 additions & 1 deletion framework-docs/src/docs/asciidoc/integration/email.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ This section describes how to send email with the Spring Framework.
The following JAR needs to be on the classpath of your application in order to use
the Spring Framework's email library:

* The https://eclipse-ee4j.github.io/mail/[JavaMail / Jakarta Mail 1.6] library
* The https://jakartaee.github.io/mail-api/[JavaMail / Jakarta Mail 1.6] library

This library is freely available on the web -- for example, in Maven Central as
`com.sun.mail:jakarta.mail`. Please make sure to use the latest 1.6.x version
rather than Jakarta Mail 2.0 (which comes with a different package namespace).
See the `v1.x` code in the https://github.com/jakartaee/mail-api/tree/v1.x[Jakarta Mail-Api repository].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something, this whole section is wrong regarding the versions.

We currently compile against jakarta.mail:jakarta.mail-api:2.0.1 for our e-mail support (pulling in dependencies on things like jakarta.mail.Message). So users of Spring Framework 6.0 must use Jakarta Mail 2.0+.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh, I made this change on the basis that the 1.6.x mention was correct, primarily because the link was 404. perhaps this needs to be evaluated / reworked separately then ? (with a specific backport to 5.3.x that looks like the edits I made)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a commit that removes that github link. So the content referring 1.6 is still probably wrong, but at least the Jakarta Mail link is fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change on the basis that the 1.6.x mention was correct,

Yes, I assumed that was the case. This is all coming from the 5.3.x version of the docs and was just an oversight (that it hasn't yet been updated in the 6.0.x docs).

I didn't mean to imply that you made an error with the versions. Rather, I just happened to notice it, because you modified that section. 😉

perhaps this needs to be evaluated / reworked separately then ? (with a specific backport to 5.3.x that looks like the edits I made)

Yes. 👍

Would you like to handle that? If not, I can take care of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'll just go ahead and address that.

****

The Spring Framework provides a helpful utility library for sending email that shields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ converters to use explicitly.

[[rest-message-conversion]]
==== Message Conversion
[.small]#<<web-reactive.adoc#webflux-codecs, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-codecs, See equivalent in the Reactive stack>>#

The `spring-web` module contains the `HttpMessageConverter` contract for reading and
writing the body of HTTP requests and responses through `InputStream` and `OutputStream`.
Expand Down
12 changes: 6 additions & 6 deletions framework-docs/src/docs/asciidoc/web/webflux-cors.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[webflux-cors]]
= CORS
[.small]#<<web.adoc#mvc-cors, Web MVC>>#
[.small]#<<web.adoc#mvc-cors, See equivalent in the Servlet stack>>#

Spring WebFlux lets you handle CORS (Cross-Origin Resource Sharing). This section
describes how to do so.
Expand All @@ -10,7 +10,7 @@ describes how to do so.

[[webflux-cors-intro]]
== Introduction
[.small]#<<web.adoc#mvc-cors-intro, Web MVC>>#
[.small]#<<web.adoc#mvc-cors-intro, See equivalent in the Servlet stack>>#

For security reasons, browsers prohibit AJAX calls to resources outside the current origin.
For example, you could have your bank account in one tab and evil.com in another. Scripts
Expand All @@ -27,7 +27,7 @@ powerful workarounds based on IFRAME or JSONP.

[[webflux-cors-processing]]
== Processing
[.small]#<<web.adoc#mvc-cors-processing, Web MVC>>#
[.small]#<<web.adoc#mvc-cors-processing, See equivalent in the Servlet stack>>#

The CORS specification distinguishes between preflight, simple, and actual requests.
To learn how CORS works, you can read
Expand Down Expand Up @@ -77,7 +77,7 @@ To learn more from the source or to make advanced customizations, see:

[[webflux-cors-controller]]
== `@CrossOrigin`
[.small]#<<web.adoc#mvc-cors-controller, Web MVC>>#
[.small]#<<web.adoc#mvc-cors-controller, See equivalent in the Servlet stack>>#

The {api-spring-framework}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`]
annotation enables cross-origin requests on annotated controller methods, as the
Expand Down Expand Up @@ -237,7 +237,7 @@ as the following example shows:

[[webflux-cors-global]]
== Global Configuration
[.small]#<<web.adoc#mvc-cors-global, Web MVC>>#
[.small]#<<web.adoc#mvc-cors-global, See equivalent in the Servlet stack>>#

In addition to fine-grained, controller method-level configuration, you probably want to
define some global CORS configuration, too. You can set URL-based `CorsConfiguration`
Expand Down Expand Up @@ -308,7 +308,7 @@ as the following example shows:

[[webflux-cors-webfilter]]
== CORS `WebFilter`
[.small]#<<web.adoc#mvc-cors-filter, Web MVC>>#
[.small]#<<web.adoc#mvc-cors-filter, See equivalent in the Servlet stack>>#

You can apply CORS support through the built-in
{api-spring-framework}/web/cors/reactive/CorsWebFilter.html[`CorsWebFilter`], which is a
Expand Down
12 changes: 6 additions & 6 deletions framework-docs/src/docs/asciidoc/web/webflux-functional.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[webflux-fn]]
= Functional Endpoints
[.small]#<<web.adoc#webmvc-fn, Web MVC>>#
[.small]#<<web.adoc#webmvc-fn, See equivalent in the Servlet stack>>#

Spring WebFlux includes WebFlux.fn, a lightweight functional programming model in which functions
are used to route and handle requests and contracts are designed for immutability.
Expand All @@ -12,7 +12,7 @@ the same <<web-reactive.adoc#webflux-reactive-spring-web>> foundation.

[[webflux-fn-overview]]
== Overview
[.small]#<<web.adoc#webmvc-fn-overview, Web MVC>>#
[.small]#<<web.adoc#webmvc-fn-overview, See equivalent in the Servlet stack>>#

In WebFlux.fn, an HTTP request is handled with a `HandlerFunction`: a function that takes
`ServerRequest` and returns a delayed `ServerResponse` (i.e. `Mono<ServerResponse>`).
Expand Down Expand Up @@ -113,7 +113,7 @@ Most applications can run through the WebFlux Java configuration, see <<webflux-

[[webflux-fn-handler-functions]]
== HandlerFunction
[.small]#<<web.adoc#webmvc-fn-handler-functions, Web MVC>>#
[.small]#<<web.adoc#webmvc-fn-handler-functions, See equivalent in the Servlet stack>>#

`ServerRequest` and `ServerResponse` are immutable interfaces that offer JDK 8-friendly
access to the HTTP request and response.
Expand Down Expand Up @@ -486,7 +486,7 @@ See <<core.adoc#validation-beanvalidation, Spring Validation>>.

[[webflux-fn-router-functions]]
== `RouterFunction`
[.small]#<<web.adoc#webmvc-fn-router-functions, Web MVC>>#
[.small]#<<web.adoc#webmvc-fn-router-functions, See equivalent in the Servlet stack>>#

Router functions are used to route the requests to the corresponding `HandlerFunction`.
Typically, you do not write router functions yourself, but rather use a method on the
Expand Down Expand Up @@ -687,7 +687,7 @@ We can further improve by using the `nest` method together with `accept`:

[[webflux-fn-running]]
== Running a Server
[.small]#<<web.adoc#webmvc-fn-running, Web MVC>>#
[.small]#<<web.adoc#webmvc-fn-running, See equivalent in the Servlet stack>>#

How do you run a router function in an HTTP server? A simple option is to convert a router
function to an `HttpHandler` by using one of the following:
Expand Down Expand Up @@ -793,7 +793,7 @@ The following example shows a WebFlux Java configuration (see

[[webflux-fn-handler-filter-function]]
== Filtering Handler Functions
[.small]#<<web.adoc#webmvc-fn-handler-filter-function, Web MVC>>#
[.small]#<<web.adoc#webmvc-fn-handler-filter-function, See equivalent in the Servlet stack>>#

You can filter handler functions by using the `before`, `after`, or `filter` methods on the routing
function builder.
Expand Down
22 changes: 11 additions & 11 deletions framework-docs/src/docs/asciidoc/web/webflux-view.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[webflux-view]]
= View Technologies
[.small]#<<web.adoc#mvc-view, Web MVC>>#
[.small]#<<web.adoc#mvc-view, See equivalent in the Servlet stack>>#

The use of view technologies in Spring WebFlux is pluggable. Whether you decide to
use Thymeleaf, FreeMarker, or some other view technology is primarily a matter of a
Expand All @@ -12,7 +12,7 @@ WebFlux. We assume you are already familiar with <<webflux-viewresolution>>.

[[webflux-view-thymeleaf]]
== Thymeleaf
[.small]#<<web.adoc#mvc-view-thymeleaf, Web MVC>>#
[.small]#<<web.adoc#mvc-view-thymeleaf, See equivalent in the Servlet stack>>#

Thymeleaf is a modern server-side Java template engine that emphasizes natural HTML
templates that can be previewed in a browser by double-clicking, which is very
Expand All @@ -33,7 +33,7 @@ https://web.archive.org/web/20210623051330/http%3A//forum.thymeleaf.org/Thymelea

[[webflux-view-freemarker]]
== FreeMarker
[.small]#<<web.adoc#mvc-view-freemarker, Web MVC>>#
[.small]#<<web.adoc#mvc-view-freemarker, See equivalent in the Servlet stack>>#

https://freemarker.apache.org/[Apache FreeMarker] is a template engine for generating any
kind of text output from HTML to email and others. The Spring Framework has built-in
Expand All @@ -43,7 +43,7 @@ integration for using Spring WebFlux with FreeMarker templates.

[[webflux-view-freemarker-contextconfig]]
=== View Configuration
[.small]#<<web.adoc#mvc-view-freemarker-contextconfig, Web MVC>>#
[.small]#<<web.adoc#mvc-view-freemarker-contextconfig, See equivalent in the Servlet stack>>#

The following example shows how to configure FreeMarker as a view technology:

Expand Down Expand Up @@ -98,7 +98,7 @@ returns the view name, `welcome`, the resolver looks for the

[[webflux-views-freemarker]]
=== FreeMarker Configuration
[.small]#<<web.adoc#mvc-views-freemarker, Web MVC>>#
[.small]#<<web.adoc#mvc-views-freemarker, See equivalent in the Servlet stack>>#

You can pass FreeMarker 'Settings' and 'SharedVariables' directly to the FreeMarker
`Configuration` object (which is managed by Spring) by setting the appropriate bean
Expand Down Expand Up @@ -151,7 +151,7 @@ the `Configuration` object.

[[webflux-view-freemarker-forms]]
=== Form Handling
[.small]#<<web.adoc#mvc-view-freemarker-forms, Web MVC>>#
[.small]#<<web.adoc#mvc-view-freemarker-forms, See equivalent in the Servlet stack>>#

Spring provides a tag library for use in JSPs that contains, among others, a
`<spring:bind/>` element. This element primarily lets forms display values from
Expand All @@ -162,7 +162,7 @@ with additional convenience macros for generating form input elements themselves

[[webflux-view-bind-macros]]
==== The Bind Macros
[.small]#<<web.adoc#mvc-view-bind-macros, Web MVC>>#
[.small]#<<web.adoc#mvc-view-bind-macros, See equivalent in the Servlet stack>>#

A standard set of macros are maintained within the `spring-webflux.jar` file for
FreeMarker, so they are always available to a suitably configured application.
Expand Down Expand Up @@ -193,7 +193,7 @@ sections of the Spring MVC documentation.

[[webflux-view-script]]
== Script Views
[.small]#<<web.adoc#mvc-view-script, Web MVC>>#
[.small]#<<web.adoc#mvc-view-script, See equivalent in the Servlet stack>>#

The Spring Framework has a built-in integration for using Spring WebFlux with any
templating library that can run on top of the
Expand All @@ -219,7 +219,7 @@ TIP: The basic rule for integrating any other script engine is that it must impl

[[webflux-view-script-dependencies]]
=== Requirements
[.small]#<<web.adoc#mvc-view-script-dependencies, Web MVC>>#
[.small]#<<web.adoc#mvc-view-script-dependencies, See equivalent in the Servlet stack>>#

You need to have the script engine on your classpath, the details of which vary by script engine:

Expand All @@ -239,7 +239,7 @@ through https://www.webjars.org/[WebJars].

[[webflux-view-script-integrate]]
=== Script Templates
[.small]#<<web.adoc#mvc-view-script-integrate, Web MVC>>#
[.small]#<<web.adoc#mvc-view-script-integrate, See equivalent in the Servlet stack>>#

You can declare a `ScriptTemplateConfigurer` bean to specify the script engine to use,
the script files to load, what function to call to render templates, and so on.
Expand Down Expand Up @@ -389,7 +389,7 @@ for more configuration examples.

[[webflux-view-httpmessagewriter]]
== JSON and XML
[.small]#<<web.adoc#mvc-view-jackson, Web MVC>>#
[.small]#<<web.adoc#mvc-view-jackson, See equivalent in the Servlet stack>>#

For <<webflux-multiple-representations>> purposes, it is useful to be able to alternate
between rendering a model with an HTML template or as other formats (such as JSON or XML),
Expand Down
12 changes: 6 additions & 6 deletions framework-docs/src/docs/asciidoc/web/webflux-websocket.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[webflux-websocket]]
= WebSockets
[.small]#<<web.adoc#websocket, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket, See equivalent in the Servlet stack>>#

This part of the reference documentation covers support for reactive-stack WebSocket
messaging.
Expand All @@ -12,7 +12,7 @@ include::websocket-intro.adoc[leveloffset=+1]

[[webflux-websocket-server]]
== WebSocket API
[.small]#<<web.adoc#websocket-server, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server, See equivalent in the Servlet stack>>#

The Spring Framework provides a WebSocket API that you can use to write client- and
server-side applications that handle WebSocket messages.
Expand All @@ -21,7 +21,7 @@ server-side applications that handle WebSocket messages.

[[webflux-websocket-server-handler]]
=== Server
[.small]#<<web.adoc#websocket-server-handler, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-handler, See equivalent in the Servlet stack>>#

To create a WebSocket server, you can first create a `WebSocketHandler`.
The following example shows how to do so:
Expand Down Expand Up @@ -339,7 +339,7 @@ subsequently use `DataBufferUtils.release(dataBuffer)` when the buffers are cons

[[webflux-websocket-server-handshake]]
=== Handshake
[.small]#<<web.adoc#websocket-server-handshake, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-handshake, See equivalent in the Servlet stack>>#

`WebSocketHandlerAdapter` delegates to a `WebSocketService`. By default, that is an instance
of `HandshakeWebSocketService`, which performs basic checks on the WebSocket request and
Expand All @@ -354,7 +354,7 @@ into the attributes of the `WebSocketSession`.

[[webflux-websocket-server-config]]
=== Server Configuration
[.small]#<<web.adoc#websocket-server-runtime-configuration, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-runtime-configuration, See equivalent in the Servlet stack>>#

The `RequestUpgradeStrategy` for each server exposes configuration specific to the
underlying WebSocket server engine. When using the WebFlux Java config you can customize
Expand Down Expand Up @@ -408,7 +408,7 @@ only Tomcat and Jetty expose such options.

[[webflux-websocket-server-cors]]
=== CORS
[.small]#<<web.adoc#websocket-server-allowed-origins, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-allowed-origins, See equivalent in the Servlet stack>>#

The easiest way to configure CORS and restrict access to a WebSocket endpoint is to
have your `WebSocketHandler` implement `CorsConfigurationSource` and return a
Expand Down