Class InvocableHandlerMethod

java.lang.Object
org.springframework.core.annotation.AnnotatedMethod
org.springframework.web.method.HandlerMethod
org.springframework.web.reactive.result.method.InvocableHandlerMethod

public class InvocableHandlerMethod extends org.springframework.web.method.HandlerMethod
Extension of HandlerMethod that invokes the underlying method with argument values resolved from the current HTTP request through a list of HandlerMethodArgumentResolver.
Since:
5.0
Author:
Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.core.annotation.AnnotatedMethod

    org.springframework.core.annotation.AnnotatedMethod.AnnotatedMethodParameter
  • Field Summary

    Fields inherited from class org.springframework.web.method.HandlerMethod

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an instance from a bean instance and a method.
    InvocableHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod)
    Create an instance from a HandlerMethod.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.core.ParameterNameDiscoverer
    Return the configured parameter name discoverer.
    Return the configured argument resolvers.
    reactor.core.publisher.Mono<HandlerResult>
    invoke(org.springframework.web.server.ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)
    Invoke the method for the given exchange.
    void
    Configure the argument resolvers to use for resolving method argument values against a ServerWebExchange.
    void
    setMethodValidator(org.springframework.validation.method.MethodValidator methodValidator)
    Set the MethodValidator to perform method validation with if the controller method HandlerMethod.shouldValidateArguments() or HandlerMethod.shouldValidateReturnValue().
    void
    setParameterNameDiscoverer(org.springframework.core.ParameterNameDiscoverer nameDiscoverer)
    Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g.
    void
    setReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry registry)
    Configure a reactive adapter registry.

    Methods inherited from class org.springframework.web.method.HandlerMethod

    assertTargetBean, createWithResolvedBean, equals, formatInvokeError, getBean, getBeanType, getContainingClass, getResolvedFromHandlerMethod, getResponseStatus, getResponseStatusReason, getShortLogMessage, hashCode, shouldValidateArguments, shouldValidateReturnValue, toString

    Methods inherited from class org.springframework.core.annotation.AnnotatedMethod

    findProvidedArgument, formatArgumentError, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hasMethodAnnotation, isVoid

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • InvocableHandlerMethod

      public InvocableHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod)
      Create an instance from a HandlerMethod.
    • InvocableHandlerMethod

      public InvocableHandlerMethod(Object bean, Method method)
      Create an instance from a bean instance and a method.
  • Method Details

    • setArgumentResolvers

      public void setArgumentResolvers(List<? extends HandlerMethodArgumentResolver> resolvers)
      Configure the argument resolvers to use for resolving method argument values against a ServerWebExchange.
    • getResolvers

      public List<HandlerMethodArgumentResolver> getResolvers()
      Return the configured argument resolvers.
    • setParameterNameDiscoverer

      public void setParameterNameDiscoverer(org.springframework.core.ParameterNameDiscoverer nameDiscoverer)
      Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g. default request attribute name).

      Default is a DefaultParameterNameDiscoverer.

    • getParameterNameDiscoverer

      public org.springframework.core.ParameterNameDiscoverer getParameterNameDiscoverer()
      Return the configured parameter name discoverer.
    • setReactiveAdapterRegistry

      public void setReactiveAdapterRegistry(org.springframework.core.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.

    • setMethodValidator

      public void setMethodValidator(@Nullable org.springframework.validation.method.MethodValidator methodValidator)
      Set the MethodValidator to perform method validation with if the controller method HandlerMethod.shouldValidateArguments() or HandlerMethod.shouldValidateReturnValue().
      Since:
      6.1
    • invoke

      public reactor.core.publisher.Mono<HandlerResult> invoke(org.springframework.web.server.ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)
      Invoke the method for the given exchange.
      Parameters:
      exchange - the current exchange
      bindingContext - the binding context to use
      providedArgs - optional list of argument values to match by type
      Returns:
      a Mono with a HandlerResult