Skip to content

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

Conversation

artembilan
Copy link
Member

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

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**
@artembilan
Copy link
Member Author

Note: this might not back-port clearly to previous version because of refactoring according Sonar reports.
So, let me know if a separate PR is needed.

Thanks

Copy link
Contributor

@garyrussell garyrussell left a 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
}
Copy link
Contributor

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.

@artembilan artembilan requested a review from garyrussell March 7, 2019 17:02
@artembilan
Copy link
Member Author

I would prefer to resolve those smells when I have already a report from Sonar.

@garyrussell garyrussell merged commit 005bc80 into spring-projects:master Mar 7, 2019
artembilan added a commit that referenced this pull request Mar 8, 2019
* 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
@artembilan
Copy link
Member Author

Back-ported to 5.1.x as a42411f after fixing conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants