As a follow-up of #31311, without a class level reflection hint on org.yaml.snakeyaml.Yaml, this error is thrown at startup in projects with an application.yml file:
java.lang.IllegalStateException: Attempted to load Config resource 'class path resource [application.yaml]' via location 'optional:classpath:/' but snakeyaml was not found on the classpath
at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:47)
at org.springframework.boot.context.config.StandardConfigDataLoader.load(StandardConfigDataLoader.java:54)
In order to avoid that, a runtime hints equivalent to this reflect-config.json should be added to Spring Boot 3:
[
{
"condition": {
"typeReachable": "org.springframework.boot.env.YamlPropertySourceLoader"
},
"name": "org.yaml.snakeyaml.Yaml"
}
]
The YamlPropertySourceLoader reachable type is designed to make this hint self documented : we explicitly declare the class that requires this hint.
Comment From: snicoll
My bad, should have been done as part of #31311