Backport of https://github.com/spring-projects/spring-framework/pull/36293
Backport of #36293