This is a follow up to #27001.

See https://github.com/spring-projects/spring-framework/pull/27001#issuecomment-850989147 for details.