Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce standard Java types in YamlProcessor #26530

Closed
bclozel opened this issue Feb 9, 2021 · 0 comments
Closed

Enforce standard Java types in YamlProcessor #26530

bclozel opened this issue Feb 9, 2021 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Feb 9, 2021

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();
@bclozel bclozel added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Feb 9, 2021
@bclozel bclozel added this to the 5.3.4 milestone Feb 9, 2021
@bclozel bclozel self-assigned this Feb 9, 2021
@bclozel bclozel closed this as completed in 58e9b18 Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant