Affects: \spring-core:5.3.15 spring-boot:2.6.3


Greetings

In the past, e.g. in a project that used spring-core:4.3.20, spring-boot:1.5.17 and, transitively, snakeyaml:1.17 I could load Java models in @ConfigurationProperties - annotated class fields, with yaml property-driven constructs, using yaml global tags, such as ```some.project: level:
property: default: !!fully.qualified.ClassName { aBooleanProperty: true }


In [older versions](https://code.google.com/archive/p/snakeyaml/wikis/Documentation.wiki) of the Snakeyaml documentation, it was stated 

> Introduced in version 1.8 of SnakeYAML is the ability to merge mappings that are then converted into custom Java objects (as opposed to simple Map objects). A merged Java object is very similar, except that the type of object must be specified.

(Don't get distracted by the mention to the merge capability, the point is to underline the ability to deserialize javabeans-compliant models from yaml.

The [current snakeyaml specification](https://bitbucket.org/snakeyaml/snakeyaml/wiki/Documentation) states:

> JavaBeans
The spec says - "One of the main goals of the JavaBeans architecture is to provide a platform neutral component architecture."
Avoiding global tags significantly improves ability to exchange the YAML documents between different platforms and languages.
If the custom Java class conforms to the JavaBean specification it can be loaded and dumped without any extra code. For instance this JavaBean

public class CarWithWheel { private String plate; private String year; private Wheel wheel; private Object part; private Map map; //...


> will be dumped as

!!package.CarWithWheel map: {id: 3} part: !!org.yaml.snakeyaml.constructor.Wheel {id: 4} plate: 12-XP-F4 wheel: {id: 2} year: '2008'

Currently, I tried to use the afore-mentioned syntax, in a new project setup with _spring-core:5.3.15_
_spring-boot:2.6.3_ and (transitively) _snakeyaml:1.29_
and I was getting an error:

org.yaml.snakeyaml.constructor.ConstructorException: could not determine a constructor for the tag tag:yaml.org,2002:com.xxxxxx.xxxxx.xxxx.xxxx.results.SampleBean in 'reader', line 544, column 17: sampleBean: !!com.xxxxxx.xxxxx.xxxx.xxxx.res ... ^

when I added this 

...

results: sampleBean: !!com.xxxxxx.xxxxx.xxxx.xxxx.results.SampleBean sampleField: true ```

in my application.yml I didn't find anything in the snakeyaml changelist section, indicating that something has changed on that matter, so I guess it must have to do with how spring leverages yaml (loads it in particular)

Comment From: snicoll

Thanks for the report but our YAML parsing facility is primarily focused on mapping YAML "key/values" to a java.util.Properties that's added to the environment. Any advanced use of YAML, such as the one described above, is out of scope. Please use another parser for this.