diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java index af36e8d6a46..5e15c240413 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java @@ -95,14 +95,19 @@ public class InvocableHandlerMethod extends HandlerMethod { /** * Invoke the method after resolving its argument values in the context of the given message. - *
Argument values are commonly resolved through {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}. + *
Argument values are commonly resolved through + * {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}. * The {@code providedArgs} parameter however may supply argument values to be used directly, * i.e. without argument resolution. + *
Delegates to {@link #getMethodArgumentValues} and calls {@link #doInvoke} with the + * resolved arguments. * @param message the current message being processed * @param providedArgs "given" arguments matched by type, not resolved * @return 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 #getMethodArgumentValues + * @see #doInvoke */ @Nullable public Object invoke(Message> message, Object... providedArgs) throws Exception { @@ -120,9 +125,12 @@ public class InvocableHandlerMethod extends HandlerMethod { } /** - * Get the method argument values for the current request. + * 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 {@link #doInvoke}. + * @since 5.1.2 */ - private Object[] getMethodArgumentValues(Message> message, Object... providedArgs) throws Exception { + protected Object[] getMethodArgumentValues(Message> message, Object... providedArgs) throws Exception { MethodParameter[] parameters = getMethodParameters(); Object[] args = new Object[parameters.length]; for (int i = 0; i < parameters.length; i++) { diff --git a/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java b/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java index 153024cb748..5a21b138018 100644 --- a/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java +++ b/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java @@ -114,17 +114,22 @@ public class InvocableHandlerMethod extends HandlerMethod { /** * Invoke the method after resolving its argument values in the context of the given request. - *
Argument values are commonly resolved through {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}. + *
Argument values are commonly resolved through + * {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}. * The {@code providedArgs} parameter however may supply argument values to be used directly, * i.e. without argument resolution. Examples of provided argument values include a * {@link WebDataBinder}, a {@link SessionStatus}, or a thrown exception instance. * Provided argument values are checked before argument resolvers. + *
Delegates to {@link #getMethodArgumentValues} and calls {@link #doInvoke} with the + * resolved arguments. * @param request the current request * @param mavContainer the ModelAndViewContainer for this request * @param providedArgs "given" arguments matched by type, not resolved * @return 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 #getMethodArgumentValues + * @see #doInvoke */ @Nullable public Object invokeForRequest(NativeWebRequest request, @Nullable ModelAndViewContainer mavContainer, @@ -138,9 +143,12 @@ public class InvocableHandlerMethod extends HandlerMethod { } /** - * Get the method argument values for the current request. + * Get the method argument values for the current request, checking the provided + * argument values and falling back to the configured argument resolvers. + *
The resulting array will be passed into {@link #doInvoke}. + * @since 5.1.2 */ - private Object[] getMethodArgumentValues(NativeWebRequest request, @Nullable ModelAndViewContainer mavContainer, + protected Object[] getMethodArgumentValues(NativeWebRequest request, @Nullable ModelAndViewContainer mavContainer, Object... providedArgs) throws Exception { MethodParameter[] parameters = getMethodParameters();