Merge branch '6.1.x'

# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
This commit is contained in:
Juergen Hoeller
2024-04-10 18:29:48 +02:00
7 changed files with 31 additions and 38 deletions

View File

@@ -188,8 +188,8 @@ class ControllerAdviceTests {
TestController controller = context.getBean(TestController.class);
controller.setException(exception);
Object actual = handle(adapter, controller, this.postExchange, Duration.ofMillis(100)
, "threadWithArg", String.class).getReturnValue();
Object actual = handle(adapter, controller, this.postExchange, Duration.ofMillis(1000),
"threadWithArg", String.class).getReturnValue();
assertThat(actual).isEqualTo(expected);
}
@@ -242,6 +242,7 @@ class ControllerAdviceTests {
}
}
@Controller
static class TestController {
@@ -249,7 +250,6 @@ class ControllerAdviceTests {
private Throwable exception;
void setValidator(Validator validator) {
this.validator = validator;
}
@@ -258,7 +258,6 @@ class ControllerAdviceTests {
this.exception = exception;
}
@InitBinder
public void initDataBinder(WebDataBinder dataBinder) {
if (this.validator != null) {
@@ -291,6 +290,7 @@ class ControllerAdviceTests {
}
}
@ControllerAdvice
@Order(1)
static class OneControllerAdvice {
@@ -323,6 +323,7 @@ class ControllerAdviceTests {
}
}
@ControllerAdvice
@Order(2)
static class SecondControllerAdvice {

View File

@@ -16,7 +16,6 @@
package org.springframework.web.reactive.result.method.annotation;
import java.time.Duration;
import java.util.Map;
import java.util.Optional;
@@ -29,6 +28,7 @@ import reactor.test.StepVerifier;
import org.springframework.core.MethodParameter;
import org.springframework.core.ReactiveAdapterRegistry;
import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.reactive.BindingContext;
@@ -105,12 +105,12 @@ class RequestParamMethodArgumentResolverTests {
@Test
void doesNotSupportReactiveWrapper() {
assertThatIllegalStateException().isThrownBy(() ->
this.resolver.supportsParameter(this.testMethod.annot(requestParam()).arg(Mono.class, String.class)))
.withMessageStartingWith("RequestParamMethodArgumentResolver does not support reactive type wrapper");
assertThatIllegalStateException().isThrownBy(() ->
this.resolver.supportsParameter(this.testMethod.annotNotPresent(RequestParam.class).arg(Mono.class, String.class)))
.withMessageStartingWith("RequestParamMethodArgumentResolver does not support reactive type wrapper");
assertThatIllegalStateException()
.isThrownBy(() -> this.resolver.supportsParameter(this.testMethod.annot(requestParam()).arg(Mono.class, String.class)))
.withMessageStartingWith("RequestParamMethodArgumentResolver does not support reactive type wrapper");
assertThatIllegalStateException()
.isThrownBy(() -> this.resolver.supportsParameter(this.testMethod.annotNotPresent(RequestParam.class).arg(Mono.class, String.class)))
.withMessageStartingWith("RequestParamMethodArgumentResolver does not support reactive type wrapper");
}
@Test
@@ -128,7 +128,7 @@ class RequestParamMethodArgumentResolverTests {
assertThat(result).asInstanceOf(array(String[].class)).containsExactly("foo", "bar");
}
@Test // gh-32577
@Test // gh-32577
void resolveStringArrayWithEmptyArraySuffix() {
MethodParameter param = this.testMethod.annotPresent(RequestParam.class).arg(String[].class);
MockServerHttpRequest request = MockServerHttpRequest.get("/path?name[]=foo&name[]=bar").build();
@@ -142,7 +142,7 @@ class RequestParamMethodArgumentResolverTests {
assertThat(resolve(param, MockServerWebExchange.from(MockServerHttpRequest.get("/")))).isEqualTo("bar");
}
@Test // SPR-17050
@Test // SPR-17050
public void resolveAndConvertNullValue() {
MethodParameter param = this.testMethod
.annot(requestParam().notRequired())
@@ -152,7 +152,6 @@ class RequestParamMethodArgumentResolverTests {
@Test
void missingRequestParam() {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
MethodParameter param = this.testMethod.annotPresent(RequestParam.class).arg(String[].class);
Mono<Object> mono = this.resolver.resolveArgument(param, this.bindContext, exchange);
@@ -214,6 +213,7 @@ class RequestParamMethodArgumentResolverTests {
}
@Nullable
private Object resolve(MethodParameter parameter, ServerWebExchange exchange) {
return this.resolver.resolveArgument(parameter, this.bindContext, exchange).block(Duration.ZERO);
}