-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix MMIHelper for reinitialization #2786
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
Fix MMIHelper for reinitialization #2786
Conversation
If we provide a custom `MessageHandlerMethodFactory`, the `MessagingMethodInvokerHelper` obtains its bean and reinitialize a `handlerMethod`, but it is done only for single, explicit and provided method. In case of `Function` or `Consumer` we use local names for methods to extract, but this is not populated to properties of the `MessagingMethodInvokerHelper` * Change an internal `MessagingMethodInvokerHelper` logic to recreate `InvocableHandlerMethod` instances based on the `MessageHandlerMethodFactory` bean for all the methods scanned on the target. * Populate a `handlerMethodsList` for the purpose above even if we have only one candidate * Fix `AggregatorParserTests` to reflect the current logic around `handlerMethodsList` * Prove that new logic works well with a custom `MessageHandlerMethodFactory` bean in the `MessagingAnnotationsWithBeanAnnotationTests` **Cherry-pick to 5.1.x**
Note: this might not back-port clearly to previous version because of refactoring according Sonar reports. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues from the review; looks good. However, I have turned on hidden variable warning in STS and this class has a lot of them and they might be flagged as new smells when Sonar runs after this is merged.
@@ -359,7 +360,7 @@ private MessagingMethodInvokerHelper(Object targetObject, Class<? extends Annota | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This CTOR should be moved up, it is out of place - not really related to this issue, though.
I would prefer to resolve those smells when I have already a report from Sonar. |
* Fix MMIHelper for reinitialization If we provide a custom `MessageHandlerMethodFactory`, the `MessagingMethodInvokerHelper` obtains its bean and reinitialize a `handlerMethod`, but it is done only for single, explicit and provided method. In case of `Function` or `Consumer` we use local names for methods to extract, but this is not populated to properties of the `MessagingMethodInvokerHelper` * Change an internal `MessagingMethodInvokerHelper` logic to recreate `InvocableHandlerMethod` instances based on the `MessageHandlerMethodFactory` bean for all the methods scanned on the target. * Populate a `handlerMethodsList` for the purpose above even if we have only one candidate * Fix `AggregatorParserTests` to reflect the current logic around `handlerMethodsList` * Prove that new logic works well with a custom `MessageHandlerMethodFactory` bean in the `MessagingAnnotationsWithBeanAnnotationTests` **Cherry-pick to 5.1.x** * * Move CTOR to the proper place # Conflicts: # spring-integration-core/src/main/java/org/springframework/integration/handler/support/MessagingMethodInvokerHelper.java # spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorParserTests.java
Back-ported to |
If we provide a custom
MessageHandlerMethodFactory
, theMessagingMethodInvokerHelper
obtains its bean and reinitialize ahandlerMethod
, but it is done only for single, explicitand provided method.
In case of
Function
orConsumer
we use local names for methods toextract, but this is not populated to properties of the
MessagingMethodInvokerHelper
MessagingMethodInvokerHelper
logic to recreateInvocableHandlerMethod
instances based on theMessageHandlerMethodFactory
bean for all the methods scanned on the target.
handlerMethodsList
for the purpose above even if we haveonly one candidate
AggregatorParserTests
to reflect the current logic aroundhandlerMethodsList
MessageHandlerMethodFactory
bean in the
MessagingAnnotationsWithBeanAnnotationTests
Cherry-pick to 5.1.x