Forward port of issue #19763 to 2.2.4.

Comment From: snicoll

Closed by https://github.com/spring-projects/spring-boot/commit/938c7a6d9f3b90cf48e3eb9259c4a84fd4736677