Resolves https://github.com/spring-projects/spring-integration/issues/8668 **cherry-pick to all supported branches**