This PR fix #31542 .

See gh-31542

Comment From: snicoll

@aooohan thank you for making your first contribution to Spring Boot.