Skip to content

GH-2690: Add MessageHandlerMethodFactory beans #2798

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

Merged
merged 2 commits into from
Mar 13, 2019

Conversation

artembilan
Copy link
Member

Fixes #2690

For more end-user flexibility and for simplicity of the MessagingMethodInvokerHelper
logic, add IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME and
IntegrationContextUtils.LIST_MESSAGE_HANDLER_FACTORY_BEAN_NAME
infrastructure beans

  • Use mentioned beans in the MessagingMethodInvokerHelper if any,
    otherwise fallback to the locally configured MessageHandlerMethodFactory,
    although this is necessary only for our non-Spring-based unit tests
  • Relax BeanFactory requirement for the EvaluationContext since it
    is going to be there in the Spring-based environment, but might not be
    available in the plain unit tests
  • Provide some optimization and refactoring for the MessagingMethodInvokerHelper
  • Remove deprecated HandlerMethodArgumentResolversHolder and
    ARGUMENT_RESOLVERS_BEAN_NAME & LIST_ARGUMENT_RESOLVERS_BEAN_NAME
    bean definitions and constants for their names

Fixes spring-projects#2690

For more end-user flexibility and for simplicity of the `MessagingMethodInvokerHelper`
logic, add `IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME` and
`IntegrationContextUtils.LIST_MESSAGE_HANDLER_FACTORY_BEAN_NAME`
infrastructure beans

* Use mentioned beans in the `MessagingMethodInvokerHelper` if any,
otherwise fallback to the locally configured `MessageHandlerMethodFactory`,
although this is necessary only for our non-Spring-based unit tests
* Relax `BeanFactory` requirement for the `EvaluationContext` since it
is going to be there in the Spring-based environment, but might not be
available in the plain unit tests
* Provide some optimization and refactoring for the `MessagingMethodInvokerHelper`
* Remove deprecated `HandlerMethodArgumentResolversHolder` and
`ARGUMENT_RESOLVERS_BEAN_NAME` & `LIST_ARGUMENT_RESOLVERS_BEAN_NAME`
bean definitions and constants for their names
@garyrussell
Copy link
Contributor

I haven't reviewed yet but the reason we log a WARN with a missing BF is because we had several components in the framework which failed to propagate the BF to the evaluator.

The warn helps us find any new errors of that kind.

I am not so keen on disabling it.

@artembilan
Copy link
Member Author

The warn helps us find any new errors of that kind.

Oh! I missed that. Sure, will revert.
Thanks for the pointer!

* Fix `MessagingMethodInvokerHelper` to propagate `BeanFactory` to
argument resolvers if any
@artembilan artembilan requested a review from garyrussell March 12, 2019 15:31
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.

Just a couple of questions. Not sure what's up with Travis; I tried re-running.

this.targetObject.getClass());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(this.targetObject.getClass() +
": Ambiguous fallback methods; using RequestReplyExchanger.exchange()");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we lose this debug log?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t understand why we need it at all even with the current master. Looks like we don’t do any fall backs, but just choose a first one for the exchange and that’s all. My feelings that it is a left over after some radical change here. So, since it doesn’t bring any value , remove it altogether!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


@Test
public void simplePayloadConfiguredWithMethodReference() throws Exception {
void simplePayloadConfiguredWithMethodReference() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change from public?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is now JUnit 5 test and that one doesn’t require public on methods. My point is that eventually we have to come fully only to JUnit 6 or already 6. The 4th one might just go EOL some day...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because public is not required, I don't see why it's worth the effort to change it all over the place; seems like unnecessary work to me.

@artembilan
Copy link
Member Author

The problem with Travis is fully related to the story about unavailability if our repo. So, we might need to hold merge of this off until resolution of that problem.

@artembilan
Copy link
Member Author

So, the Travis build is green.

@garyrussell garyrussell merged commit d53433c into spring-projects:master Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants