spring-beans
ships a YamlProcessor
that's used as a base class by YamlMapFactoryBean
and YamlPropertiesFactoryBean
. These implementations have a clear use case: mapping application-internal Yaml documents for configuration or infrastructure purposes.
Since this use case rarely requires extended types support from the underlying library, and since we're offering ways to list custom types (since #25152), we'll restrict to java standard types only by default. This simplifies the setup and focuses the abstract class on the core use cases.
Developers can leverage #25152 to allow custom types like this:
YamlMapFactoryBean factory = new YamlMapFactoryBean();
factory.setResources(resource);
// Allow constructors for custom types User and Book
factory.setSupportedTypes(User.class, Book.class);
Map<String, Object> map = factory.getObject();