Class InvocableHandlerMethod
java.lang.Object
org.springframework.core.annotation.AnnotatedMethod
org.springframework.messaging.handler.HandlerMethod
org.springframework.messaging.handler.invocation.InvocableHandlerMethod
Extension of 
HandlerMethod that invokes the underlying method with
 argument values resolved from the current HTTP request through a list of
 HandlerMethodArgumentResolver.- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.core.annotation.AnnotatedMethodAnnotatedMethod.AnnotatedMethodParameter
- 
Field SummaryFields inherited from class org.springframework.messaging.handler.HandlerMethoddefaultLogger, logger
- 
Constructor SummaryConstructorsConstructorDescriptionInvocableHandlerMethod(Object bean, Method method) Create an instance from a bean instance and a method.InvocableHandlerMethod(Object bean, String methodName, Class<?>... parameterTypes) Construct a new handler method with the given bean instance, method name and parameters.InvocableHandlerMethod(HandlerMethod handlerMethod) Create an instance from aHandlerMethod.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectInvoke the handler method with the given argument values.protected Object[]getMethodArgumentValues(Message<?> message, Object... providedArgs) Get the method argument values for the current message, checking the provided argument values and falling back to the configured argument resolvers.Invoke the method after resolving its argument values in the context of the given message.voidsetMessageMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers) SetHandlerMethodArgumentResolversto use for resolving method argument values.voidsetParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer) Set the ParameterNameDiscoverer for resolving parameter names when needed (for example, default request attribute name).Methods inherited from class org.springframework.messaging.handler.HandlerMethodassertTargetBean, createWithResolvedBean, equals, formatInvokeError, getBean, getBeanType, getContainingClass, getLogger, getResolvedFromHandlerMethod, getShortLogMessage, hashCode, setLoggerMethods inherited from class org.springframework.core.annotation.AnnotatedMethodfindProvidedArgument, formatArgumentError, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hasMethodAnnotation, isVoid, toString
- 
Constructor Details- 
InvocableHandlerMethodCreate an instance from aHandlerMethod.
- 
InvocableHandlerMethodCreate an instance from a bean instance and a method.
- 
InvocableHandlerMethodpublic InvocableHandlerMethod(Object bean, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException Construct a new handler method with the given bean instance, method name and parameters.- Parameters:
- bean- the object bean
- methodName- the method name
- parameterTypes- the method parameter types
- Throws:
- NoSuchMethodException- when the method cannot be found
 
 
- 
- 
Method Details- 
setMessageMethodArgumentResolverspublic void setMessageMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers) SetHandlerMethodArgumentResolversto use for resolving method argument values.
- 
setParameterNameDiscovererSet the ParameterNameDiscoverer for resolving parameter names when needed (for example, default request attribute name).Default is a DefaultParameterNameDiscoverer.
- 
invoke@Nullable public Object invoke(Message<?> message, @Nullable Object... providedArgs) throws Exception Invoke the method after resolving its argument values in the context of the given message.Argument values are commonly resolved through HandlerMethodArgumentResolvers. TheprovidedArgsparameter however may supply argument values to be used directly, i.e. without argument resolution.Delegates to getMethodArgumentValues(org.springframework.messaging.Message<?>, java.lang.Object...)and callsdoInvoke(java.lang.Object...)with the resolved arguments.- Parameters:
- message- the current message being processed
- providedArgs- "given" arguments matched by type, not resolved
- Returns:
- the raw value returned by the invoked method
- Throws:
- Exception- raised if no suitable argument resolver can be found, or if the method raised an exception
- See Also:
 
- 
getMethodArgumentValuesprotected Object[] getMethodArgumentValues(Message<?> message, @Nullable Object... providedArgs) throws Exception Get the method argument values for the current message, checking the provided argument values and falling back to the configured argument resolvers.The resulting array will be passed into doInvoke(java.lang.Object...).- Throws:
- Exception
- Since:
- 5.1.2
 
- 
doInvokeInvoke the handler method with the given argument values.- Throws:
- Exception
 
 
-