Backport of gh-29513

Comment From: snicoll

Fixed by https://github.com/spring-projects/spring-framework/commit/a18842b72b779664bc9ae40714a86a08449958d9