Forward port of issue #33206 to 2.7.x.
Comment From: izeye
This seems to be a duplicate of https://github.com/spring-projects/spring-boot/issues/33206 as the milestone for https://github.com/spring-projects/spring-boot/issues/33206 has been changed to "2.7.x" that is the same one for this issue.