Forward port of issue #19926 to 2.2.5.
Comment From: wilkinsona
Re-opening as we may need to revert this change. See https://github.com/spring-projects/spring-boot/pull/19926#issuecomment-586142069 for details.
Comment From: snicoll
See https://github.com/spring-projects/spring-boot/pull/19926#issuecomment-586172784