Skip to content

Commit b699b65

Browse files
committed
Merge branch '6.2.x'
2 parents 72b42bb + be17315 commit b699b65

File tree

9 files changed

+64
-21
lines changed

9 files changed

+64
-21
lines changed

framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-async.adoc

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
Spring MVC has an extensive integration with Servlet asynchronous request
55
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-processing[processing]:
66

7-
* xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-deferredresult[`DeferredResult`] and xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-callable[`Callable`]
8-
return values in controller methods provide basic support for a single asynchronous
9-
return value.
7+
* xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-deferredresult[`DeferredResult`],
8+
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-callable[`Callable`], and
9+
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-webasynctask[`WebAsyncTask`] return values
10+
in controller methods provide support for a single asynchronous return value.
1011
* Controllers can xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-http-streaming[stream] multiple values, including
11-
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-sse[SSE] and xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-output-stream[raw data].
12+
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-sse[SSE] and
13+
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-output-stream[raw data].
1214
* Controllers can use reactive clients and return
1315
xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-reactive-types[reactive types] for response handling.
1416

@@ -96,6 +98,47 @@ xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-configuration-spring-mvc[config
9698

9799

98100

101+
102+
[[mvc-ann-async-webasynctask]]
103+
== `WebAsyncTask`
104+
105+
`WebAsyncTask` is comparable to using xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-callable[Callable]
106+
but allows customizing additional settings such a request timeout value, and the
107+
`AsyncTaskExecutor` to execute the `java.util.concurrent.Callable` with instead
108+
of the defaults set up globally for Spring MVC. Below is an example of using `WebAsyncTask`:
109+
110+
[tabs]
111+
======
112+
Java::
113+
+
114+
[source,java,indent=0,subs="verbatim,quotes"]
115+
----
116+
@GetMapping("/callable")
117+
WebAsyncTask<String> handle() {
118+
return new WebAsyncTask<String>(20000L,()->{
119+
Thread.sleep(10000); //simulate long-running task
120+
return "asynchronous request completed";
121+
});
122+
}
123+
----
124+
125+
Kotlin::
126+
+
127+
[source,kotlin,indent=0,subs="verbatim,quotes"]
128+
----
129+
@GetMapping("/callable")
130+
fun handle(): WebAsyncTask<String> {
131+
return WebAsyncTask(20000L) {
132+
Thread.sleep(10000) // simulate long-running task
133+
"asynchronous request completed"
134+
}
135+
}
136+
----
137+
======
138+
139+
140+
141+
99142
[[mvc-ann-async-processing]]
100143
== Processing
101144

@@ -390,7 +433,7 @@ reactive types from the controller method.
390433
Reactive return values are handled as follows:
391434

392435
* A single-value promise is adapted to, similar to using `DeferredResult`. Examples
393-
include `Mono` (Reactor) or `Single` (RxJava).
436+
include `CompletionStage` (JDK), Mono` (Reactor), and `Single` (RxJava).
394437
* A multi-value stream with a streaming media type (such as `application/x-ndjson`
395438
or `text/event-stream`) is adapted to, similar to using `ResponseBodyEmitter` or
396439
`SseEmitter`. Examples include `Flux` (Reactor) or `Observable` (RxJava).

spring-context/src/main/java/org/springframework/validation/ValidationUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -250,7 +250,7 @@ public static void rejectIfEmptyOrWhitespace(
250250

251251
Assert.notNull(errors, "Errors object must not be null");
252252
Object value = errors.getFieldValue(field);
253-
if (value == null ||!StringUtils.hasText(value.toString())) {
253+
if (value == null || !StringUtils.hasText(value.toString())) {
254254
errors.rejectValue(field, errorCode, errorArgs, defaultMessage);
255255
}
256256
}

spring-core/src/test/java/org/springframework/core/annotation/AnnotationBackCompatibilityTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
3232
class AnnotationBackCompatibilityTests {
3333

3434
@Test
35-
void multiplRoutesToMetaAnnotation() {
35+
void multipleRoutesToMetaAnnotation() {
3636
Class<?> source = WithMetaMetaTestAnnotation1AndMetaTestAnnotation2.class;
3737
// Merged annotation chooses lowest depth
3838
MergedAnnotation<TestAnnotation> mergedAnnotation = MergedAnnotations.from(source).get(TestAnnotation.class);

spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ void getDirectFromClassFavorsMoreLocallyDeclaredComposedAnnotationsOverInherited
984984
}
985985

986986
@Test
987-
void getDirectFromClassgetDirectFromClassMetaMetaAnnotatedClass() {
987+
void getDirectFromClassGetDirectFromClassMetaMetaAnnotatedClass() {
988988
MergedAnnotation<?> annotation = MergedAnnotations.from(
989989
MetaMetaAnnotatedClass.class, SearchStrategy.TYPE_HIERARCHY).get(Component.class);
990990
assertThat(annotation.getString("value")).isEqualTo("meta2");

spring-core/src/test/java/org/springframework/core/convert/converter/ConverterTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ void andThenWhenGivenConverterThenComposesInOrder() {
4646
}
4747

4848
@Test
49-
void andThenCanConvertfromDifferentSourceType() {
49+
void andThenCanConvertFromDifferentSourceType() {
5050
Converter<String, Integer> length = String::length;
5151
assertThat(length.andThen(this.moduloTwo).convert("example")).isEqualTo(1);
5252
assertThat(length.andThen(this.addOne).convert("example")).isEqualTo(8);

spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -491,8 +491,8 @@ void patternComparator() {
491491
assertThat(comparator.compare("/hotels/{hotel}/bookings/{booking}", "/hotels/{hotel}/booking")).isEqualTo(1);
492492

493493
// SPR-10550
494-
assertThat(comparator.compare("/hotels/{hotel}/bookings/{booking}/cutomers/{customer}", "/**")).isEqualTo(-1);
495-
assertThat(comparator.compare("/**", "/hotels/{hotel}/bookings/{booking}/cutomers/{customer}")).isEqualTo(1);
494+
assertThat(comparator.compare("/hotels/{hotel}/bookings/{booking}/customers/{customer}", "/**")).isEqualTo(-1);
495+
assertThat(comparator.compare("/**", "/hotels/{hotel}/bookings/{booking}/customers/{customer}")).isEqualTo(1);
496496
assertThat(comparator.compare("/**", "/**")).isEqualTo(0);
497497

498498
assertThat(comparator.compare("/hotels/{hotel}", "/hotels/*")).isEqualTo(-1);
@@ -505,8 +505,8 @@ void patternComparator() {
505505
assertThat(comparator.compare("/hotels/{hotel}", "/hotels/{hotel}.*")).isEqualTo(2);
506506

507507
// SPR-6741
508-
assertThat(comparator.compare("/hotels/{hotel}/bookings/{booking}/cutomers/{customer}", "/hotels/**")).isEqualTo(-1);
509-
assertThat(comparator.compare("/hotels/**", "/hotels/{hotel}/bookings/{booking}/cutomers/{customer}")).isEqualTo(1);
508+
assertThat(comparator.compare("/hotels/{hotel}/bookings/{booking}/customers/{customer}", "/hotels/**")).isEqualTo(-1);
509+
assertThat(comparator.compare("/hotels/**", "/hotels/{hotel}/bookings/{booking}/customers/{customer}")).isEqualTo(1);
510510
assertThat(comparator.compare("/hotels/foo/bar/**", "/hotels/{hotel}")).isEqualTo(1);
511511
assertThat(comparator.compare("/hotels/{hotel}", "/hotels/foo/bar/**")).isEqualTo(-1);
512512

spring-core/src/test/kotlin/org/springframework/core/BridgeMethodResolverKotlinTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test
2222
/**
2323
* Kotlin tests for [BridgeMethodResolver].
2424
*
25-
* @author Sebastien Deleuzes
25+
* @author Sebastien Deleuze
2626
*/
2727
class BridgeMethodResolverKotlinTests {
2828

spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public URI getURI() {
104104

105105
/**
106106
* Set the {@link ClientHttpResponse} to be used as the result of executing
107-
* the this request.
107+
* this request.
108108
* @see #execute()
109109
*/
110110
public void setResponse(ClientHttpResponse clientHttpResponse) {

spring-web/src/test/java/org/springframework/http/converter/json/SpringHandlerInstantiatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void autowiredKeyDeserializer() throws IOException {
104104
}
105105

106106
@Test
107-
void applicationContextAwaretypeResolverBuilder() throws JsonProcessingException {
107+
void applicationContextAwareTypeResolverBuilder() throws JsonProcessingException {
108108
this.objectMapper.writeValueAsString(new Group());
109109
assertThat(CustomTypeResolverBuilder.isAutowiredFiledInitialized).isTrue();
110110
}

0 commit comments

Comments
 (0)