parent
521cda009b
commit
b68f76c86e
|
|
@ -247,6 +247,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||||
if (ObjectUtils.isEmpty(parameters)) {
|
if (ObjectUtils.isEmpty(parameters)) {
|
||||||
return EMPTY_ARGS;
|
return EMPTY_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Mono<Object>> argMonos = new ArrayList<>(parameters.length);
|
List<Mono<Object>> argMonos = new ArrayList<>(parameters.length);
|
||||||
for (MethodParameter parameter : parameters) {
|
for (MethodParameter parameter : parameters) {
|
||||||
parameter.initParameterNameDiscovery(this.parameterNameDiscoverer);
|
parameter.initParameterNameDiscovery(this.parameterNameDiscoverer);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -104,6 +104,12 @@ class ControllerMethodResolver {
|
||||||
|
|
||||||
private final ReactiveAdapterRegistry reactiveAdapterRegistry;
|
private final ReactiveAdapterRegistry reactiveAdapterRegistry;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private final Scheduler invocationScheduler;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private final Predicate<? super HandlerMethod> blockingMethodPredicate;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final MethodValidator methodValidator;
|
private final MethodValidator methodValidator;
|
||||||
|
|
||||||
|
|
@ -122,12 +128,6 @@ class ControllerMethodResolver {
|
||||||
|
|
||||||
private final Map<Class<?>, SessionAttributesHandler> sessionAttributesHandlerCache = new ConcurrentHashMap<>(64);
|
private final Map<Class<?>, SessionAttributesHandler> sessionAttributesHandlerCache = new ConcurrentHashMap<>(64);
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private final Scheduler invocationScheduler;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private final Predicate<? super HandlerMethod> blockingMethodPredicate;
|
|
||||||
|
|
||||||
|
|
||||||
ControllerMethodResolver(
|
ControllerMethodResolver(
|
||||||
ArgumentResolverConfigurer customResolvers, ReactiveAdapterRegistry adapterRegistry,
|
ArgumentResolverConfigurer customResolvers, ReactiveAdapterRegistry adapterRegistry,
|
||||||
|
|
@ -323,9 +323,7 @@ class ControllerMethodResolver {
|
||||||
invocable.setArgumentResolvers(this.requestMappingResolvers);
|
invocable.setArgumentResolvers(this.requestMappingResolvers);
|
||||||
invocable.setReactiveAdapterRegistry(this.reactiveAdapterRegistry);
|
invocable.setReactiveAdapterRegistry(this.reactiveAdapterRegistry);
|
||||||
invocable.setMethodValidator(this.methodValidator);
|
invocable.setMethodValidator(this.methodValidator);
|
||||||
//getSchedulerFor returns null if not applicable, which is ok here
|
|
||||||
invocable.setInvocationScheduler(getSchedulerFor(handlerMethod));
|
invocable.setInvocationScheduler(getSchedulerFor(handlerMethod));
|
||||||
|
|
||||||
return invocable;
|
return invocable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class InvocableHandlerMethodTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void resolveNoArgsOnSchedulerThread() {
|
void resolveNoArgsOnSchedulerThread() {
|
||||||
Method method = ResolvableMethod.on(TestController.class).mockCall(o -> o.noArgsThread()).method();
|
Method method = ResolvableMethod.on(TestController.class).mockCall(TestController::noArgsThread).method();
|
||||||
Mono<HandlerResult> mono = invokeOnScheduler(Schedulers.newSingle("good"), new TestController(), method);
|
Mono<HandlerResult> mono = invokeOnScheduler(Schedulers.newSingle("good"), new TestController(), method);
|
||||||
|
|
||||||
assertHandlerResultValue(mono, "on thread: good-", false);
|
assertHandlerResultValue(mono, "on thread: good-", false);
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,9 @@ class ControllerAdviceTests {
|
||||||
|
|
||||||
Method method = controller.getClass().getMethod(methodName, parameterTypes);
|
Method method = controller.getClass().getMethod(methodName, parameterTypes);
|
||||||
HandlerMethod handlerMethod = new HandlerMethod(controller, method);
|
HandlerMethod handlerMethod = new HandlerMethod(controller, method);
|
||||||
return adapter.handle(exchange, handlerMethod).block(timeout);
|
HandlerResult handlerResult = adapter.handle(exchange, handlerMethod).block(timeout);
|
||||||
|
assertThat(handlerResult).isNotNull();
|
||||||
|
return handlerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,7 @@ class ModelInitializerTests {
|
||||||
|
|
||||||
ControllerMethodResolver methodResolver = new ControllerMethodResolver(
|
ControllerMethodResolver methodResolver = new ControllerMethodResolver(
|
||||||
resolverConfigurer, adapterRegistry, new StaticApplicationContext(),
|
resolverConfigurer, adapterRegistry, new StaticApplicationContext(),
|
||||||
Collections.emptyList(), null,
|
Collections.emptyList(), null, null, null);
|
||||||
null, null);
|
|
||||||
|
|
||||||
this.modelInitializer = new ModelInitializer(methodResolver, adapterRegistry);
|
this.modelInitializer = new ModelInitializer(methodResolver, adapterRegistry);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -78,10 +78,8 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe
|
||||||
url += "/";
|
url += "/";
|
||||||
assertThat(getRestTemplate().getForObject(url, String.class)).isEqualTo("root");
|
assertThat(getRestTemplate().getForObject(url, String.class)).isEqualTo("root");
|
||||||
|
|
||||||
assertThat(getApplicationContext().getBean(TestExecutor.class).invocationCount.get())
|
assertThat(getApplicationContext().getBean(TestExecutor.class).invocationCount.get()).isEqualTo(4);
|
||||||
.as("executor").isEqualTo(4);
|
assertThat(getApplicationContext().getBean(TestPredicate.class).invocationCount.get()).isEqualTo(4);
|
||||||
assertThat(getApplicationContext().getBean(TestPredicate.class).invocationCount.get())
|
|
||||||
.as("predicate").isEqualTo(4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedHttpServerTest
|
@ParameterizedHttpServerTest
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue