Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvocableHandlerMethod should call GenericTypeResolver with getBeanType() and only once [SPR-15186] #19752

spring-projects-issues opened this issue Jan 24, 2017 · 0 comments
in: messaging in: web type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Jan 24, 2017

Artem Bilan opened SPR-15186 and commented

The code to review:

public Object invoke(Message<?> message, Object... providedArgs) throws Exception {
	Object[] args = getMethodArgumentValues(message, providedArgs);

private 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++) {
			MethodParameter parameter = parameters[i];
			GenericTypeResolver.resolveParameterType(parameter, getBean().getClass());

Looks like we always call that GenericTypeResolver.resolveParameterType() for the same reason and for the same arguments.

That could be done directly in the initMethodParameters(), which is called from the constructor.

Plus we should keep in mind that getBean() not always returns target object. There is beanName-based constructor. Consider to switch to the getBeanType().

We have an interesting observation in Spring Integration when this InvocableHandlerMethod approach is slower than Compiled SpEL, but that is different story...

Plus it would be great to reconsider properties and accessors visibility in the InvocableHandlerMethod and DefaultMessageHandlerMethodFactory. Right now they are not good for extension...


Affects: 4.3.5

Issue Links:

  • #19705 org.springframework.messaging.handler.invocation.InvocableHandlerMethod should not mention "controller"

Referenced from: commits 8038fb9, a98a618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: messaging in: web type: bug
None yet

No branches or pull requests

2 participants