Skip to content

Enforce standard Java types in YamlProcessor #26530

@bclozel

Description

@bclozel

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();

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions