Similar to issues #27071 and #27072 the YamlPropertySourceLoader does not use an alternate classloader if one is provided to the SpringApplication. The problem can be found here https://github.com/spring-projects/spring-boot/blob/f06b784d6ea8f1faccf5b37b0a36905df4ac7fe7/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java#L46.

Comment From: wilkinsona

Let's roll this into #27134.

Comment From: wilkinsona

Having gone through the possible problems listed in #27134 and some more that weren't listed, I've changed my mind about this one. I'm leaning towards just fixing this specific case and leaving the others as-is until they cause a problem for someone. IMO, the possible risk of regression outweighs the benefits at the moment.