Class InvocableHandlerMethod
- java.lang.Object
- org.springframework.web.method.HandlerMethod
- org.springframework.web.reactive.result.method.InvocableHandlerMethod
public class InvocableHandlerMethod extends HandlerMethod
Extension ofHandlerMethod
that invokes the underlying method with argument values resolved from the current HTTP request through a list ofHandlerMethodArgumentResolver
.- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.web.method.HandlerMethod
HandlerMethod.HandlerMethodParameter
Field Summary
Fields inherited from class org.springframework.web.method.HandlerMethod
logger
Constructor Summary
Constructors Constructor Description InvocableHandlerMethod(Object bean, Method method)
Create an instance from a bean instance and a method.InvocableHandlerMethod(HandlerMethod handlerMethod)
Create an instance from aHandlerMethod
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterNameDiscoverer
getParameterNameDiscoverer()
Return the configured parameter name discoverer.List<HandlerMethodArgumentResolver>
getResolvers()
Return the configured argument resolvers.reactor.core.publisher.Mono<HandlerResult>
invoke(ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)
Invoke the method for the given exchange.void
setArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
Configure the argument resolvers to use to use for resolving method argument values against aServerWebExchange
.void
setParameterNameDiscoverer(ParameterNameDiscoverer nameDiscoverer)
Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g.void
setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
Configure a reactive adapter registry.Methods inherited from class org.springframework.web.method.HandlerMethod
assertTargetBean, createWithResolvedBean, equals, findProvidedArgument, formatArgumentError, formatInvokeError, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getResolvedFromHandlerMethod, getResponseStatus, getResponseStatusReason, getReturnType, getReturnValueType, getShortLogMessage, hashCode, hasMethodAnnotation, isVoid, toString
Constructor Detail
InvocableHandlerMethod
public InvocableHandlerMethod(HandlerMethod handlerMethod)
Create an instance from aHandlerMethod
.
InvocableHandlerMethod
public InvocableHandlerMethod(Object bean, Method method)
Create an instance from a bean instance and a method.
Method Detail
setArgumentResolvers
public void setArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
Configure the argument resolvers to use to use for resolving method argument values against aServerWebExchange
.
getResolvers
public List<HandlerMethodArgumentResolver> getResolvers()
Return the configured argument resolvers.
setParameterNameDiscoverer
public void setParameterNameDiscoverer(ParameterNameDiscoverer nameDiscoverer)
Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g. default request attribute name).Default is a
DefaultParameterNameDiscoverer
.
getParameterNameDiscoverer
public ParameterNameDiscoverer getParameterNameDiscoverer()
Return the configured parameter name discoverer.
setReactiveAdapterRegistry
public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
Configure a reactive adapter registry. This is needed for cases where the response is fully handled within the controller in combination with an async void return value.By default this is a
ReactiveAdapterRegistry
with default settings.
invoke
public reactor.core.publisher.Mono<HandlerResult> invoke(ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)
Invoke the method for the given exchange.- Parameters:
exchange
- the current exchangebindingContext
- the binding context to useprovidedArgs
- optional list of argument values to match by type- Returns:
- a Mono with a
HandlerResult