-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix BeanFactory propagation for MMInvokerHelper #2694
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 BeanFactory propagation for MMInvokerHelper #2694
Conversation
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.
Just 2 comments.
@@ -56,7 +56,10 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { | |||
public T processMessage(Message<?> message) { | |||
if (this.delegate == null) { |
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.
2019
BeanFactory beanFactory = getBeanFactory(); | ||
return beanFactory != null | ||
&& beanFactory.containsBean(IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME); | ||
return getBeanFactory().containsBean(IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME); | ||
} |
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.
Given the extensive changes to the tests, this looks like it's a big breaking change. Should we retain the null check until 5.2?
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.
Even if we have such a check here, that doesn't mean that we are good to live with the propagation bug in the BeanNameMessageProcessor
and RecipientListRouter
. I mean this with the beanFactory != null
we jsut mask the real problem in several places and we may have some questions in the future from community.
Not sure why massive changes in the tests scares you to merge it as a bug into the current version...
More over some tests have critical issues with not closed application context which may cause sporadic failures on CI.
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.
My point is that we'll get an NPE, which is never good.
Perhaps add an Assert.state()
in initialize()
and also remove the null checks there?
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.
Right. That is my next step after some review here. We really don't have consistency over there.
The point is that without BF
propagation our method invocations might be different and that could be some kind of surprise for end-users.
But I really can relax the requirement here and bring check back. As long as I have a fix for propagation and we are protected in tests already 😄
So, do we have a deal to merge this into the current version if I revert NPe check in the MessagingMethodInvokerHelper
?
We really can make it strict then in the next version catching more non-propagated bean factory if any...
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.
So, do we have a deal to merge this into the current version if I revert NPe check in the MessagingMethodInvokerHelper?
We really can make it strict then in the next version catching more non-propagated bean factory if any...
Agreed.
* Remove check for `null` in the `MessagingMethodInvokerHelper.isProvidedMessageHandlerFactoryBean()` * Fix `RecipientListRouter` for `BeanFactory` propagation to the `Recipient.selector` * Fix tests for `BeanFactory` population and propagation * Add `errorChannel` into the `TestUtils.createTestApplicationContext()` * Fix some Sonar smell, including new reported
`MessagingMethodInvokerHelper` to avoid breaking changes in the current point release * Some other polishing and optimizations in the `MessagingMethodInvokerHelper`
2011ee9
to
ab94a68
Compare
Pushed the fix as we discussed after rebasing. |
null
in theMessagingMethodInvokerHelper.isProvidedMessageHandlerFactoryBean()
RecipientListRouter
forBeanFactory
propagation to theRecipient.selector
BeanFactory
population and propagationerrorChannel
into theTestUtils.createTestApplicationContext()