Forward port of issue #21293 to 2.3.x.

Comment From: mbhave

Closed by https://github.com/spring-projects/spring-boot/commit/83485e625d613dc360d208c231097d105a550ac4