Fixes #26217

Comment From: snicoll

@zeldigas thank you for making your first contribution to Spring Boot. I've polished things in d610f3c . In particular, the sourceType is not mandatory and that was breaking with a NPE in that case.

Comment From: zeldigas

Great, thank you!